Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions LadybugTools_Engine/Compute/InstallPythonEnv_LBT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ public static PythonEnvironment InstallPythonEnv_LBT(bool run = false, bool rein
// check if environment already exists. If it does, and no reinstall requested, load it
bool exists = Python.Query.VirtualEnvironmentExists(envName: Query.ToolkitName(), pythonVersion: pythonVersion);
if (run && exists && !reinstall)
return Python.Compute.VirtualEnvironment(version: pythonVersion, name: Query.ToolkitName(), reload: true);
{
PythonEnvironment existing = Python.Compute.VirtualEnvironment(version: pythonVersion, name: Query.ToolkitName(), reload: true);
FixLadybugConfig(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles), "ladybug_tools"));
return existing;
}

// create environment from scratch
PythonEnvironment env = Python.Compute.VirtualEnvironment(version: pythonVersion, name: Query.ToolkitName(), reload: false);
Expand All @@ -59,14 +63,34 @@ public static PythonEnvironment InstallPythonEnv_LBT(bool run = false, bool rein
env.InstallPackageLocal(Path.Combine(Python.Query.DirectoryCode(), Query.ToolkitName()));

// create requirements from referenced executable
string requirementsTxt = Python.Compute.RequirementsTxt(referencedExecutable, Path.Combine(Python.Query.DirectoryEnvironments(), $"requirements_{Query.ToolkitName()}.txt"));
env.InstallRequirements(requirementsTxt);
/* NOTE: following commented lines was original method before we started just copying the direct requirements to our pyproject.toml
*
* string requirementsTxt = Python.Compute.RequirementsTxt(referencedExecutable, Path.Combine(Python.Query.DirectoryEnvironments(), $"requirements_{Query.ToolkitName()}.txt"));
* env.InstallRequirements(requirementsTxt);
*/

FixLadybugConfig(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles), "ladybug_tools"));

return env;
}
}
}

/// <summary>
/// Fix for if user home directory contains ladybug_tools (perhaps from old installation). This will break environments where users rely on that folder overriding the ladybug folder in program files.
/// </summary>
/// <param name="targetFolder"></param>
private static void FixLadybugConfig(string targetFolder)
{
string userLbtFolder = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile), "ladybug_tools");
if (!Directory.Exists(userLbtFolder))
return;

BH.Engine.Base.Compute.RecordNote($"The folder '{userLbtFolder}' was found, and as this can cause issues with referenceing Radiance and OpenStudio, the ladybug config has been explicitly pointed to the installation in Program Files.");

string command = $"{Python.Modify.AddQuotesIfRequired(System.IO.Path.Combine(Python.Query.VirtualEnvironmentDirectory(Query.ToolkitName()), "Scripts", "ladybug.exe"))} set-config ladybug-tools-folder {Python.Modify.AddQuotesIfRequired(targetFolder)}";

string stdOut = Python.Compute.RunCommandStdout(command);

BH.Engine.Base.Compute.RecordNote($"Set explicit ladybug config path. stdOut:\n{stdOut}");
}
}
}
8 changes: 4 additions & 4 deletions LadybugTools_Engine/Python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#The bhom_python_toolkit image must exist in the docker image container, see https://github.com/BHoM/Python_Toolkit.
FROM bhom_python_toolkit:latest
FROM bhom_python_toolkit_3_13:latest

#Install ladybugtools_toolkit packages.
COPY . /LadybugTools_Toolkit
Expand All @@ -11,9 +11,9 @@ RUN apt-get update \
&& apt-get install wget -y

#Install openstudio and dependencies.
RUN wget https://github.com/NREL/OpenStudio/releases/download/v3.10.0/OpenStudio-3.10.0+86d7e215a1-Ubuntu-22.04-x86_64.deb \
&& dpkg-deb -R OpenStudio-3.10.0+86d7e215a1-Ubuntu-22.04-x86_64.deb . \
&& rm OpenStudio-3.10.0+86d7e215a1-Ubuntu-22.04-x86_64.deb \
RUN wget https://github.com/NatLabRockies/OpenStudio/releases/download/v3.11.0/OpenStudio-3.11.0+241b8abb4d-Ubuntu-22.04-x86_64.deb \
&& dpkg-deb -R OpenStudio-3.11.0+241b8abb4d-Ubuntu-22.04-x86_64.deb . \
&& rm OpenStudio-3.11.0+241b8abb4d-Ubuntu-22.04-x86_64.deb \
&& apt install libgomp1 libx11-6 -y

#install radiance
Expand Down
179 changes: 100 additions & 79 deletions LadybugTools_Engine/Python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,85 +22,106 @@ dependencies = [
"scipy",
"tables",
"tqdm",
"xlrd","attrs",
"Brotli",
"click",
"click-plugins",
"colorama",
"contourpy",
"cycler",
"dragonfly-comparison",
"dragonfly-core",
"dragonfly-display",
"dragonfly-doe2",
"dragonfly-energy",
"dragonfly-radiance",
"dragonfly-schema",
"dragonfly-uwg",
"fonttools",
"honeybee-core",
"honeybee-display",
"honeybee-doe2",
"honeybee-energy",
"honeybee-energy-standards",
"honeybee-idaice",
"honeybee-ies",
"honeybee-openstudio",
"honeybee-radiance",
"honeybee-radiance-command",
"honeybee-radiance-folder",
"honeybee-radiance-postprocess",
"honeybee-schema",
"honeybee-standards",
"inflate64",
"jsonschema",
"jsonschema-specifications",
"kiwisolver",
"ladybug-comfort",
"ladybug-core",
"ladybug-display",
"ladybug-display-schema",
"ladybug-geometry",
"ladybug-geometry-polyskel",
"ladybug-radiance",
"ladybug-rhino",
"ladybug-vtk",
"lbt-dragonfly==0.12.99",
"lbt-honeybee==0.9.95",
"lbt-ladybug==0.27.150",
"lbt-recipes==0.26.23",
"lockfile",
"luigi",
"matplotlib",
"multivolumefile",
"numpy",
"openstudio",
"packaging",
"pillow",
"pollination-handlers",
"psutil",
"py7zr",
"pybcj",
"pycryptodomex",
"pydantic==1.10.22",
"pydantic-openapi-helper==0.2.11",
"pyparsing",
"pyppmd",
"python-daemon",
"python-dateutil",
"PyYAML",
"pyzstd",
"queenbee",
"queenbee-local",
"referencing",
"rpds-py",
"six",
"tenacity",
"texttable",
"tornado",
"typing_extensions",
"uwg",
"vtk",
"xlrd",
#----POLLINATION DERIVED DEPENDENCIES----#
"annotated-types==0.8.0",
"attrs==26.1.0",
"backports.zstd==1.7.0",
"brotli==1.2.0",
"click==8.1.7",
"click-plugins==1.1.1.2",
"colorama==0.4.6",
"contourpy==1.3.3",
"cupy-cuda12x==13.6.0",
"cycler==0.12.1",
"dragonfly-comparison==0.1.4",
"dragonfly-core==1.77.1",
"dragonfly-designbuilder==0.1.10",
"dragonfly-display==0.5.0",
"dragonfly-doe2==0.12.19",
"dragonfly-energy==1.46.4",
"dragonfly-idaice==0.1.4",
"dragonfly-iesve==0.2.6",
"dragonfly-openstudio==0.2.5",
"dragonfly-radiance==0.4.223",
"dragonfly-schema==2.2.3",
"dragonfly-uwg==0.5.743",
"fairyfly-core==0.2.37",
"fairyfly-therm==0.10.18",
"fairyfly-therm-standards==0.1.0",
"fastrlock==0.8.3",
"fonttools==4.63.0",
"honeybee-core==1.64.65",
"honeybee-designbuilder==0.4.5",
"honeybee-display==0.6.3",
"honeybee-doe2==0.23.6",
"honeybee-energy==1.123.23",
"honeybee-energy-standards==2.3.4",
"honeybee-idaice==1.3.3",
"honeybee-ies==0.14.3",
"honeybee-openstudio==0.6.0",
"honeybee-radiance==1.66.285",
"honeybee-radiance-command==1.23.0",
"honeybee-radiance-folder==2.11.17",
"honeybee-radiance-postprocess==0.5.11",
"honeybee-schema==2.2.0",
"honeybee-standards==2.0.7",
"inflate64==1.0.4",
"jsonschema==4.26.0",
"jsonschema-specifications==2025.9.1",
"kiwisolver==1.5.0",
"ladybug-comfort==0.19.5",
"ladybug-core==0.44.56",
"ladybug-display==0.14.3",
"ladybug-display-schema==1.0.1",
"ladybug-geometry==1.35.3",
"ladybug-geometry-polyskel==1.7.52",
"ladybug-radiance==0.2.12",
"ladybug-rhino==1.45.0",
"ladybug-vtk==0.16.1",
"lbt-dragonfly==0.13.218",
"lbt-honeybee==0.9.451",
"lbt-ladybug==0.27.200",
"lbt-recipes==0.28.9",
"lockfile==0.12.2",
"loguru==0.7.3",
"luigi==3.3.0",
"matplotlib==3.11.1",
"multivolumefile==0.2.3",
"numpy==2.1.0",
"openstudio==3.11.0",
"openstudio-backporter==0.2.0",
"packaging==26.3",
"pillow==12.3.0",
"pollination-handlers==0.10.17",
"psutil==7.2.2",
"py7zr==1.1.0",
"pybcj==1.0.8",
"pycryptodomex==3.23.0",
"pydantic==2.13.4",
"pydantic-openapi-helper==1.0.5",
"pydantic_core==2.46.4",
"pyparsing==3.3.2",
"pyppmd==1.3.1",
"python-daemon==3.1.2",
"python-dateutil==2.9.0.post0",
"PyYAML==6.0.3",
"queenbee==2.0.1",
"queenbee-local==1.0.3",
"referencing==0.37.0",
"rpds-py==2026.6.3",
"setuptools==80.9.0",
"setuptools-scm==9.2.2",
"six==1.17.0",
"tenacity==8.5.0",
"texttable==1.7.0",
"tornado==6.5.7",
"typing-inspection==0.4.4",
"typing_extensions==4.16.0",
"uwg==5.8.13",
"vtk==9.7.0",
"wheel==0.48.0",
"win32_setctime==1.2.0; sys_platform == 'win32'",
]

[urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ def cmap(self) -> Colormap:
colors = [to_rgba(i) for i in colors]

cmap = ListedColormap(colors=colors, name=self.name)
cmap.set_over(self.colors[-1])
cmap.set_under(self.colors[0])
cmap.with_extremes(over=self.colors[-1], under=self.colors[0])
return cmap

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
zhang_huang_solar_split)
from ladybug.sunpath import Sunpath
from ladybug_geometry.geometry2d import Vector2D
from meteostat import Hourly, Point
from meteostat import hourly, Point
from python_toolkit.bhom.analytics import bhom_analytics
from .bhom.logger import CONSOLE_LOGGER
from .ladybug_extension.dt import lb_datetime_from_datetime
Expand Down Expand Up @@ -905,7 +905,7 @@ def scrape_meteostat(
raise ValueError("The end_date must be a datetime object or string.")

location = Point(latitude, longitude, altitude)
data = Hourly(location, start_date, end_date).fetch()
data = hourly(location, start_date, end_date).fetch()

if len(data) == 0:
raise ValueError("No data was returned from Meteostat.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def evaporative_cooling_potential_epw(epw: EPW, ax: plt.Axes = None, **kwargs) -
dbt=collection_to_series(epw.dry_bulb_temperature),
dpt=collection_to_series(epw.dew_point_temperature),
ax=ax,
title=kwargs.pop("title", Path(epw.file_path).name)
title=kwargs.pop("title", Path(epw.file_path).name),
**kwargs
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class PsychrometricPolygons:

strategies: list[PassiveStrategy] = field(init=True, default_factory=list)
strategy_parameters: PassiveStrategyParameters = field(
init=True, default=PassiveStrategyParameters()
init=True, default_factory=PassiveStrategyParameters
)
pmv_parameter: PMVParameter = field(init=True, default=PMVParameter())
pmv_parameter: PMVParameter = field(init=True, default_factory=PMVParameter)
mean_radiant_temperature: float = field(init=True, default=None)
air_speed: float = field(init=True, default=0.1)
metabolic_rate: float = field(init=True, default=1.1)
Expand Down
2 changes: 1 addition & 1 deletion LadybugTools_Engine/Query/IsPollinationInstalled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static partial class Query
[Description("Return True if Pollination is installed to the currently supported version.")]
[Input("targetPollinationVersion", "The target Pollination version that BHoM currently supports.")]
[Output("bool", "True if Pollination is installed to the currently supported version.")]
public static bool IsPollinationInstalled(string targetPollinationVersion = "1.65.10")
public static bool IsPollinationInstalled(string targetPollinationVersion = "1.70.19")
{
// check if referenced Python is installed
string referencedExecutable = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) + @"\ladybug_tools\python\python.exe";
Expand Down
Loading