Skip to content

Commit bb8ee21

Browse files
Python bug fixes, including Wind.from_csv datetimeindex (#334)
2 parents ba556f5 + 746df25 commit bb8ee21

15 files changed

Lines changed: 27 additions & 21 deletions

File tree

LadybugTools_Adapter/AdapterActions/Execute/HBJSONToGEMCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ public List<object> RunCommand(HBJSONToGEMCommand command, ActionConfig actionCo
7979
}
8080

8181
//as the file output is hard to verify by itself, check that no errors got output to stderr log
82-
success &= !result.Contains("Traceback (most recent call last):");
82+
success &= (!result.Contains("Traceback (most recent call last):") || result.Length == 0);
8383

8484
if (!success)
8585
{
8686
BH.Engine.Base.Compute.RecordError($"An error occurred while converting the file to gem.\nPython output: {result}.");
8787
return new List<object>();
8888
}
8989

90-
string outputFileName = Path.Combine(command.OutputDirectory, Path.GetFileNameWithoutExtension(command.HBJSONFile.FileName) + ".hbjson");
90+
string outputFileName = Path.Combine(command.OutputDirectory, Path.GetFileNameWithoutExtension(command.HBJSONFile.FileName) + ".gem");
9191
File.WriteAllText(outputFileName, result);
9292

9393
m_executeSuccess = success;

LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/epw_to_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def epw_to_csv(epw_file: str, include_additional: bool) -> str:
3636
return csv_str
3737
except Exception:
3838
CONSOLE_LOGGER.error("CSV file could not be created.", exc_info=1)
39-
return ""
39+
return traceback.format_exc()
4040

4141
if __name__ == "__main__":
4242
args = PARSER.parse_args()

LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/gem_to_hbjson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def gem_to_hbjson(gem_file: str) -> None:
4545
return json.dumps(model_dict)
4646
except Exception:
4747
CONSOLE_LOGGER.error("HBJSON file could not be created.", exc_info=1)
48-
return ""
48+
return traceback.format_exc()
4949

5050

5151
if __name__ == "__main__":

LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/hbjson_to_gem.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ def hbjson_to_gem(hbjson_file: str) -> None:
4141
model = Model.from_dict(hbjson_dict)
4242
name = str(uuid.uuid4()) + ".gem"
4343
model_to_ies(
44-
model, folder=tempfile.gettempdir, name=name
44+
model, folder=tempfile.gettempdir(), name=name
4545
)
4646

47-
gem_file = (Path(tempfile.gettempdir) / name)
47+
gem_file = (Path(tempfile.gettempdir()) / name)
4848
gem = gem_file.read_text()
4949
gem_file.unlink()
5050

5151
return gem
5252
except Exception:
5353
CONSOLE_LOGGER.error("Could not convert the hbjson file to a gem file.", exc_info=1)
54-
return ""
54+
return traceback.format_exc()
5555

5656

5757
if __name__ == "__main__":

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def directional_solar_radiation(epw_file, directions, tilts, irradiance_type, an
116116

117117
except Exception:
118118
CONSOLE_LOGGER.error("Solar Radiation plot could not be created.", exc_info=1)
119-
return ""
119+
return traceback.format_exc()
120120

121121
if __name__ == "__main__":
122122
args = PARSER.parse_args()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def diurnal(epw_file, data_type_key="Dry Bulb Temperature", colour="#000000", ti
9191

9292
except Exception:
9393
CONSOLE_LOGGER.error("Diurnal plot could not be created.", exc_info=1)
94-
return ""
94+
return traceback.format_exc()
9595

9696
if __name__ == "__main__":
9797
args = PARSER.parse_args()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
import json
66
import sys
7+
import traceback
78
import matplotlib
89
import matplotlib.figure
910
from ladybug.epw import EPW
@@ -84,7 +85,7 @@ def heatmap(epw_file: str, data_type_key: str, colour_map: str, save_path:str =
8485

8586
except Exception:
8687
CONSOLE_LOGGER.error("Heatmap could not be created.", exc_info=1)
87-
return ""
88+
return traceback.format_exc()
8889

8990

9091
if __name__ == "__main__":

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def sunpath(epw_file, analysis_period, size, save_path) -> str:
7373

7474
except Exception:
7575
CONSOLE_LOGGER.error("Sunpath could not be created.", exc_info=1)
76-
return ""
76+
return traceback.format_exc()
7777

7878
if __name__ == "__main__":
7979

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def utci_heatmap(input_json:str, save_path = None, epw_file:str = None) -> str:
8282
return json.dumps(return_dict, default=str)
8383
except Exception:
8484
CONSOLE_LOGGER.error("UTCI Heatmap could not be created.", exc_info=1)
85-
return ""
85+
return traceback.format_exc()
8686

8787
if __name__ == "__main__":
8888
args = PARSER.parse_args()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def walkability_heatmap(input_json: str, save_path: str, epw_file:str = None) ->
6464

6565
except Exception:
6666
CONSOLE_LOGGER.error("Walkability plot could not be created.", exc_info=1)
67-
return ""
67+
return traceback.format_exc()
6868

6969
if __name__ == "__main__":
7070

0 commit comments

Comments
 (0)