diff --git a/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/diurnal.py b/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/diurnal.py index 4409a3c0..fac3c48c 100644 --- a/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/diurnal.py +++ b/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/diurnal.py @@ -9,6 +9,7 @@ def diurnal(epw_file, return_file: str, data_type_key="Dry Bulb Temperature", co try: from ladybug.epw import EPW, AnalysisPeriod from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series + from ladybugtools_toolkit.ladybug_extension.epw import wet_bulb_temperature from ladybugtools_toolkit.plot._diurnal import diurnal from ladybug.datacollection import HourlyContinuousCollection from ladybugtools_toolkit.plot.utilities import figure_to_base64 @@ -16,13 +17,15 @@ def diurnal(epw_file, return_file: str, data_type_key="Dry Bulb Temperature", co import matplotlib.pyplot as plt epw = EPW(epw_file) - data_type_key = data_type_key.replace("_"," ") - coll = HourlyContinuousCollection.from_dict([a for a in epw.to_dict()["data_collections"] if a["header"]["data_type"]["name"] == data_type_key][0]) - fig = diurnal(collection_to_series(coll), title=title, period=period, color=color).get_figure() + if data_type_key == "Wet Bulb Temperature": + coll = wet_bulb_temperature(epw) + else: + coll = HourlyContinuousCollection.from_dict([a for a in epw.to_dict()["data_collections"] if a["header"]["data_type"]["name"] == data_type_key][0]) + fig = diurnal(collection_to_series(coll),title=title, period=period, color=color).get_figure() return_dict = {"data": collection_metadata(coll)} - + if save_path == None or save_path == "": base64 = figure_to_base64(fig, html=False) return_dict["figure"] = base64 diff --git a/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/heatmap.py b/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/heatmap.py index adf74e40..cc8341fb 100644 --- a/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/heatmap.py +++ b/LadybugTools_Engine/Python/src/ladybugtools_toolkit/bhom/wrapped/plot/heatmap.py @@ -14,14 +14,21 @@ def heatmap(epw_file: str, data_type_key: str, colour_map: str, return_file: str from ladybugtools_toolkit.plot._heatmap import heatmap from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series from ladybugtools_toolkit.bhom.wrapped.metadata.collection import collection_metadata + from ladybugtools_toolkit.ladybug_extension.epw import wet_bulb_temperature from ladybugtools_toolkit.plot.utilities import figure_to_base64 import matplotlib.pyplot as plt if colour_map not in plt.colormaps(): colour_map = "YlGnBu" + epw = EPW(epw_file) - coll = HourlyContinuousCollection.from_dict([a for a in epw.to_dict()["data_collections"] if a["header"]["data_type"]["name"] == data_type_key][0]) + + if data_type_key == "Wet Bulb Temperature": + coll = wet_bulb_temperature(epw) + else: + coll = HourlyContinuousCollection.from_dict([a for a in epw.to_dict()["data_collections"] if a["header"]["data_type"]["name"] == data_type_key][0]) + fig = heatmap(collection_to_series(coll), cmap=colour_map).get_figure() return_dict = {} diff --git a/LadybugTools_oM/Enum/EPWKeys.cs b/LadybugTools_oM/Enum/EPWKeys.cs index 06a63245..0f93147b 100644 --- a/LadybugTools_oM/Enum/EPWKeys.cs +++ b/LadybugTools_oM/Enum/EPWKeys.cs @@ -74,6 +74,10 @@ public enum EPWKey [DisplayText("Total Sky Cover")] TotalSkyCover, Visibility, + [DisplayText("Wet Bulb Temperature")] + [Description("Wet bulb temperature is a calculated property of epw data.")] + // This was added to handle calculating wet bulb temperature with c#/python interop. If utilising this enum for other purposes, ensure that this value being selected by a user is handled correctly (either by showing an appropriate error, or calculating the wet bulb temperature) + WetBulbTemperature, [DisplayText("Wind Direction")] WindDirection, [DisplayText("Wind Speed")]