Skip to content

Commit 767db4b

Browse files
Fix json decode error in Walkability, and compliance (#343)
2 parents ac3e631 + 44d99c5 commit 767db4b

6 files changed

Lines changed: 34 additions & 6 deletions

File tree

File renamed without changes.

LadybugTools_Engine/Create/ExternalComfort.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,24 @@
2323
using BH.Engine.Adapter;
2424
using BH.Engine.LadybugTools;
2525
using BH.oM.Adapter;
26+
using BH.oM.Base.Attributes;
2627
using BH.oM.LadybugTools;
2728
using System;
2829
using System.Collections.Generic;
30+
using System.ComponentModel;
2931
using System.Text;
3032

3133
namespace BH.Engine.LadyBugTools
3234
{
3335
public static partial class Create
3436
{
37+
[Description("Create an ExternalComfort object from an epw file, a simulation identifier, two materials and a typology (without a SimulationResult).")]
38+
[Input("epwFile", "The epw file that the created SimulationResult is based on.")]
39+
[Input("identifier", "The unique identifier for the created SimulationResult.")]
40+
[Input("groundMaterial", "The material to use for the ground in the simulation.")]
41+
[Input("shadeMaterial", "The material to use for the shade in the simulation.")]
42+
[Input("typology", "The typology to use.")]
43+
[Output("externalComfort", "The unpopulated external comfort.")]
3544
public static ExternalComfort ExternalComfort(FileSettings epwFile, string identifier, IEnergyMaterialOpaque groundMaterial, IEnergyMaterialOpaque shadeMaterial, Typology typology)
3645
{
3746
return new ExternalComfort()
@@ -41,6 +50,10 @@ public static ExternalComfort ExternalComfort(FileSettings epwFile, string ident
4150
};
4251
}
4352

53+
[Description("Create an ExternalComfort object from an existing SimulationResult and a Typology.")]
54+
[Input("simulationResult", "The existing simulation result to use for this external comfort.")]
55+
[Input("typology", "The typology to use.")]
56+
[Output("externalComfort", "The unpopulated external comfort.")]
4457
public static ExternalComfort ExternalComfort(SimulationResult simulationResult, Typology typology)
4558
{
4659
return new ExternalComfort()

LadybugTools_Engine/Create/SimulationResult.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,23 @@
2121
*/
2222

2323
using BH.oM.Adapter;
24+
using BH.oM.Base.Attributes;
2425
using BH.oM.LadybugTools;
2526
using System;
2627
using System.Collections.Generic;
28+
using System.ComponentModel;
2729
using System.Text;
2830

2931
namespace BH.Engine.LadyBugTools
3032
{
3133
public static partial class Create
3234
{
35+
[Description("Create an unpopulated SimulationResult from an epw file, identifier and two materials.")]
36+
[Input("epwFile", "The epw file that the created SimulationResult is based on.")]
37+
[Input("identifier", "The unique identifier for the created SimulationResult.")]
38+
[Input("groundMaterial", "The material to use for the ground in the simulation.")]
39+
[Input("shadeMaterial", "The material to use for the shade in the simulation.")]
40+
[Output("simulationResult", "The unpopulated SimulationResult.")]
3341
public static SimulationResult SimulationResult(FileSettings epwFile, string identifier, IEnergyMaterialOpaque groundMaterial, IEnergyMaterialOpaque shadeMaterial)
3442
{
3543
return new SimulationResult()

LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/walkability_heatmap.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
def walkability_heatmap(input_json: str, save_path: str, epw_file:str = None) -> str:
4141
try:
4242
style = os.environ.get("BHOM_style_context", "python_toolkit.bhom")
43+
44+
if not input_json.startswith("{"): #assume it's a path
45+
with open(input_json, "r") as f:
46+
input_json = f.read()
47+
4348
argsDict = json.loads(input_json)
4449

4550
ec = ExternalComfort.from_dict(json.loads(argsDict["external_comfort"]))

LadybugTools_Engine/Query/PythonCodeDirectory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
using System;
2424
using System.Collections.Generic;
25+
using System.ComponentModel;
2526
using System.IO;
2627
using System.Reflection;
2728
using System.Text;
@@ -30,6 +31,7 @@ namespace BH.Engine.LadybugTools
3031
{
3132
public static partial class Query
3233
{
34+
[Description("Gets the custom code folder for this toolkit if it exists, otherwise gets the default BHoM/Extensions/PythonCode folder.")]
3335
public static string PythonCodeDirectory()
3436
{
3537
string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "PythonCode");

LadybugTools_oM/MetaData/SolarRadiationData.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ public class SolarRadiationData: ISimulationData
3333
{
3434
[DisplayText("Maximum Value")]
3535
[Description("The maximum incoming solar radiation.")]
36-
public double MaxValue { get; set; } = double.NaN;
36+
public virtual double MaxValue { get; set; } = double.NaN;
3737

3838
[DisplayText("Minimum Value")]
3939
[Description("The minimum incoming solar radiation.")]
40-
public double MinValue { get; set; } = double.NaN;
40+
public virtual double MinValue { get; set; } = double.NaN;
4141

4242
[DisplayText("Maximum Direction")]
4343
[Description("The direction, in degrees(°) clockwise from north that the maximum incoming solar radiation is coming from.")]
44-
public double MaxDirection { get; set; } = double.NaN;
44+
public virtual double MaxDirection { get; set; } = double.NaN;
4545

4646
[DisplayText("Minimum Direction")]
4747
[Description("The direction, in degrees(°) clockwise from north that the minimum incoming solar radiation is coming from.")]
48-
public double MinDirection { get; set; } = double.NaN;
48+
public virtual double MinDirection { get; set; } = double.NaN;
4949

5050
[DisplayText("Maximum Tilt")]
5151
[Description("The angle, in degrees(°) above the horizon that the maximum incoming solar radiation is coming from.")]
52-
public double MaxTilt { get; set; } = double.NaN;
52+
public virtual double MaxTilt { get; set; } = double.NaN;
5353

5454
[DisplayText("Minimum Tilt")]
5555
[Description("The angle, in degrees(°) above the horizon that the minimum incoming solar radiation is coming from.")]
56-
public double MinTilt { get; set;} = double.NaN;
56+
public virtual double MinTilt { get; set;} = double.NaN;
5757
}
5858
}
5959

0 commit comments

Comments
 (0)