Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downselect geojson buildings to only include buildings from sys-params file #16

Merged
merged 7 commits into from
Feb 29, 2024
Merged
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ repos:
# - id: check-hooks-apply # Fails if a hook doesn't apply to any file
# Run the Ruff linter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.3.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, pyi, jupyter]
# Run the Ruff formatter
# https://docs.astral.sh/ruff/integrations/#pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.3.0
hooks:
- id: ruff-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"buildings": [
{
"geojson_id": "2",
"geojson_id": "8",
"load_model": "time_series",
"load_model_parameters": {
"time_series": {
Expand Down Expand Up @@ -43,7 +43,7 @@
}
},
{
"geojson_id": "5",
"geojson_id": "9",
"load_model": "time_series",
"load_model_parameters": {
"time_series": {
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ classifiers = [
]
dependencies = [
'click ~= 8.1',
'ghedesigner ~= 1.3',
'ghedesigner ~= 1.4',
'pandas ~= 2.1',
"rich ~= 13.6",
]
Expand All @@ -40,7 +40,7 @@ dev = [
"pytest >= 6.0",
"pytest-cov ~= 4.1",
"pre-commit ~= 3.5",
"ruff ~= 0.1",
"ruff ~= 0.3",
"jupyterlab ~= 4.0",
]

Expand Down
1 change: 1 addition & 0 deletions thermalnetwork/ground_heat_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def ghe_size(self, total_space_loads, output_path: Path) -> float:
min_eft=self.json_data["design"]["min_eft"],
max_height=self.json_data["geometric_constraints"]["max_height"],
min_height=self.json_data["geometric_constraints"]["min_height"],
continue_if_design_unmet=True,
)
ghe.set_ground_loads_from_hourly_list(self.json_data["loads"]["ground_loads"])
ghe.set_geometry_constraints_rectangle(
Expand Down
24 changes: 23 additions & 1 deletion thermalnetwork/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,29 @@ def run_sizer_from_cli_worker(
return 1

system_parameters_data = json.loads(system_parameter_path.read_text())
# print(f"system_parameters_data: {system_parameters_data}")

# Downselect the buildings in the geojson that are in the system parameters file

# List the building ids from the system parameters file
building_id_list = []
for building in system_parameters_data["buildings"]:
building_id_list.append(building["geojson_id"])

# Select the buildings in the geojson that are in the system parameters file
building_features = [
feature
for feature in geojson_data["features"]
if feature["properties"]["type"] == "Building" and feature["properties"]["id"] in building_id_list
]

# Rebuild the geojson data using only the buildings in the system parameters file
# Put in everything that isn't a building
geojson_data["features"] = [
feature for feature in geojson_data["features"] if feature["properties"]["type"] != "Building"
]
# Only add the buildings in the system parameters file back to the geojson data
# This has the effect of removing buildings that are not in the system parameters file
geojson_data["features"].extend(building_features)

# load all input data
sys_param_version: int = system_parameters_data["district_system"]["fifth_generation"]["ghe_parameters"]["version"]
Expand Down
Loading