Skip to content

Commit a6f9536

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5bb701a commit a6f9536

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

Snakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ rule build_existing_chp_de:
590590
regions=resources("regions_onshore_base_s_{clusters}.geojson"),
591591
district_heating_subnodes=(
592592
resources("district_heating_subnodes_base_s_{clusters}.geojson")
593-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
593+
if config_provider("sector", "district_heating", "subnodes", "enable")
594+
== True
594595
else []
595596
),
596597
output:

rules/build_sector.smk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ rule build_temperature_profiles:
201201
pop_layout=resources("pop_layout_total.nc"),
202202
regions_onshore=(
203203
resources("regions_onshore_base-extended_s_{clusters}.geojson")
204-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
204+
if config_provider("sector", "district_heating", "subnodes", "enable")
205+
== True
205206
else resources("regions_onshore_base_s_{clusters}.geojson")
206207
),
207208
cutout=lambda w: input_cutout(
@@ -274,7 +275,8 @@ rule build_central_heating_temperature_profiles:
274275
temp_air_total=resources("temp_air_total_base_s_{clusters}.nc"),
275276
regions_onshore=(
276277
resources("regions_onshore_base-extended_s_{clusters}.geojson")
277-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
278+
if config_provider("sector", "district_heating", "subnodes", "enable")
279+
== True
278280
else resources("regions_onshore_base_s_{clusters}.geojson")
279281
),
280282
output:
@@ -322,7 +324,8 @@ rule build_geothermal_heat_potential:
322324
isi_heat_potentials="data/isi_heat_utilisation_potentials.xlsx",
323325
regions_onshore=(
324326
resources("regions_onshore_base-restricted_s_{clusters}.geojson")
325-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
327+
if config_provider("sector", "district_heating", "subnodes", "enable")
328+
== True
326329
else resources("regions_onshore_base_s_{clusters}.geojson")
327330
),
328331
lau_regions="data/lau_regions.zip",
@@ -369,7 +372,8 @@ rule build_cop_profiles:
369372
temp_air_total=resources("temp_air_total_base_s_{clusters}.nc"),
370373
regions_onshore=(
371374
resources("regions_onshore_base-extended_s_{clusters}.geojson")
372-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
375+
if config_provider("sector", "district_heating", "subnodes", "enable")
376+
== True
373377
else resources("regions_onshore_base_s_{clusters}.geojson")
374378
),
375379
output:

rules/solve_myopic.smk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ rule add_existing_baseyear:
1919
resources(
2020
"networks/base-extended_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}.nc"
2121
)
22-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
22+
if config_provider("sector", "district_heating", "subnodes", "enable")
23+
== True
2324
else resources(
2425
"networks/base_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}.nc"
2526
)
@@ -38,7 +39,8 @@ rule add_existing_baseyear:
3839
resources(
3940
"existing_heating_distribution_base-extended_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}.csv"
4041
)
41-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
42+
if config_provider("sector", "district_heating", "subnodes", "enable")
43+
== True
4244
else resources(
4345
"existing_heating_distribution_base_s_{clusters}_{planning_horizons}.csv"
4446
)
@@ -102,7 +104,8 @@ rule add_brownfield:
102104
resources(
103105
"networks/base-extended_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}.nc"
104106
)
105-
if config_provider("sector", "district_heating", "subnodes", "enable") == True
107+
if config_provider("sector", "district_heating", "subnodes", "enable")
108+
== True
106109
else resources(
107110
"networks/base_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}.nc"
108111
)

scripts/pypsa-de/add_district_heating_subnodes.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44

55
import os
66
import sys
7+
from typing import Dict, List
78

89
import geopandas as gpd
910
import pandas as pd
1011
import pypsa
1112
import xarray as xr
12-
from typing import Dict, List
13-
14-
import os
15-
import sys
1613

1714
sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
1815

@@ -156,13 +153,13 @@ def add_loads(
156153
)
157154

158155
# Adjust loads of cluster buses
159-
n.loads_t.p_set.loc[
160-
:, f'{subnode["cluster"]} urban central heat'
161-
] -= urban_central_heat_load
156+
n.loads_t.p_set.loc[:, f"{subnode['cluster']} urban central heat"] -= (
157+
urban_central_heat_load
158+
)
162159

163-
n.loads.loc[
164-
f'{subnode["cluster"]} low-temperature heat for industry', "p_set"
165-
] -= low_temperature_heat_for_industry_load
160+
n.loads.loc[f"{subnode['cluster']} low-temperature heat for industry", "p_set"] -= (
161+
low_temperature_heat_for_industry_load
162+
)
166163

167164
if lost_load > 0:
168165
lost_load_subnode = subnode["yearly_heat_demand_MWh"] - (
@@ -506,6 +503,7 @@ def add_subnodes(
506503
Dictionary mapping heat sources to paths with potential data.
507504
output_path : str
508505
Path to save the subnodes_head GeoDataFrame.
506+
509507
Returns
510508
-------
511509
None
@@ -525,7 +523,7 @@ def add_subnodes(
525523

526524
# Add subnodes to network
527525
for _, subnode in subnodes_head.iterrows():
528-
name = f'{subnode["cluster"]} {subnode["Stadt"]} urban central'
526+
name = f"{subnode['cluster']} {subnode['Stadt']} urban central"
529527

530528
# Add different component types
531529
add_buses(n, subnode, name)

0 commit comments

Comments
 (0)