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

remove {scope} wildcard #1171

Merged
merged 4 commits into from
Jul 24, 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
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Upcoming Release

* Bugfix: Impose minimum value of zero for district heating progress between current and future market share in :mod:`build_district_heat_share`.

* The ``{scope}`` wildcard was removed, since its outputs were not used.

* Enable parallelism in :mod:`determine_availability_matrix_MD_UA.py` and remove plots. This requires the use of temporary files.

* Updated pre-built `weather data cutouts
Expand Down
7 changes: 0 additions & 7 deletions doc/wildcards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ The ``{sector_opts}`` wildcard is only used for sector-coupling studies.
:widths: 10,20,10,10
:file: configtables/sector-opts.csv

.. _scope:

The ``{scope}`` wildcard
========================

Takes values ``residential``, ``urban``, ``total``.

.. _planning_horizons:

The ``{planning_horizons}`` wildcard
Expand Down
60 changes: 17 additions & 43 deletions rules/build_sector.smk
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,18 @@ rule build_daily_heat_demand:
snapshots=config_provider("snapshots"),
drop_leap_day=config_provider("enable", "drop_leap_day"),
input:
pop_layout=resources("pop_layout_{scope}.nc"),
pop_layout=resources("pop_layout_total.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
cutout=heat_demand_cutout,
output:
heat_demand=resources("daily_heat_demand_{scope}_elec_s{simpl}_{clusters}.nc"),
heat_demand=resources("daily_heat_demand_total_elec_s{simpl}_{clusters}.nc"),
resources:
mem_mb=20000,
threads: 8
log:
logs("build_daily_heat_demand_{scope}_{simpl}_{clusters}.loc"),
logs("build_daily_heat_demand_total_{simpl}_{clusters}.loc"),
benchmark:
benchmarks("build_daily_heat_demand/{scope}_s{simpl}_{clusters}")
benchmarks("build_daily_heat_demand/total_s{simpl}_{clusters}")
conda:
"../envs/environment.yaml"
script:
Expand All @@ -175,16 +175,16 @@ rule build_hourly_heat_demand:
drop_leap_day=config_provider("enable", "drop_leap_day"),
input:
heat_profile="data/heat_load_profile_BDEW.csv",
heat_demand=resources("daily_heat_demand_{scope}_elec_s{simpl}_{clusters}.nc"),
heat_demand=resources("daily_heat_demand_total_elec_s{simpl}_{clusters}.nc"),
output:
heat_demand=resources("hourly_heat_demand_{scope}_elec_s{simpl}_{clusters}.nc"),
heat_demand=resources("hourly_heat_demand_total_elec_s{simpl}_{clusters}.nc"),
resources:
mem_mb=2000,
threads: 8
log:
logs("build_hourly_heat_demand_{scope}_{simpl}_{clusters}.loc"),
logs("build_hourly_heat_demand_total_{simpl}_{clusters}.loc"),
benchmark:
benchmarks("build_hourly_heat_demand/{scope}_s{simpl}_{clusters}")
benchmarks("build_hourly_heat_demand/total_s{simpl}_{clusters}")
conda:
"../envs/environment.yaml"
script:
Expand All @@ -196,19 +196,19 @@ rule build_temperature_profiles:
snapshots=config_provider("snapshots"),
drop_leap_day=config_provider("enable", "drop_leap_day"),
input:
pop_layout=resources("pop_layout_{scope}.nc"),
pop_layout=resources("pop_layout_total.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
cutout=heat_demand_cutout,
output:
temp_soil=resources("temp_soil_{scope}_elec_s{simpl}_{clusters}.nc"),
temp_air=resources("temp_air_{scope}_elec_s{simpl}_{clusters}.nc"),
temp_soil=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"),
temp_air=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"),
resources:
mem_mb=20000,
threads: 8
log:
logs("build_temperature_profiles_{scope}_{simpl}_{clusters}.log"),
logs("build_temperature_profiles_total_{simpl}_{clusters}.log"),
benchmark:
benchmarks("build_temperature_profiles/{scope}_s{simpl}_{clusters}")
benchmarks("build_temperature_profiles/total_s{simpl}_{clusters}")
conda:
"../envs/environment.yaml"
script:
Expand All @@ -220,18 +220,10 @@ rule build_cop_profiles:
heat_pump_sink_T=config_provider("sector", "heat_pump_sink_T"),
input:
temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"),
temp_soil_rural=resources("temp_soil_rural_elec_s{simpl}_{clusters}.nc"),
temp_soil_urban=resources("temp_soil_urban_elec_s{simpl}_{clusters}.nc"),
temp_air_total=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"),
temp_air_rural=resources("temp_air_rural_elec_s{simpl}_{clusters}.nc"),
temp_air_urban=resources("temp_air_urban_elec_s{simpl}_{clusters}.nc"),
output:
cop_soil_total=resources("cop_soil_total_elec_s{simpl}_{clusters}.nc"),
cop_soil_rural=resources("cop_soil_rural_elec_s{simpl}_{clusters}.nc"),
cop_soil_urban=resources("cop_soil_urban_elec_s{simpl}_{clusters}.nc"),
cop_air_total=resources("cop_air_total_elec_s{simpl}_{clusters}.nc"),
cop_air_rural=resources("cop_air_rural_elec_s{simpl}_{clusters}.nc"),
cop_air_urban=resources("cop_air_urban_elec_s{simpl}_{clusters}.nc"),
resources:
mem_mb=20000,
log:
Expand Down Expand Up @@ -263,18 +255,18 @@ rule build_solar_thermal_profiles:
drop_leap_day=config_provider("enable", "drop_leap_day"),
solar_thermal=config_provider("solar_thermal"),
input:
pop_layout=resources("pop_layout_{scope}.nc"),
pop_layout=resources("pop_layout_total.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
cutout=solar_thermal_cutout,
output:
solar_thermal=resources("solar_thermal_{scope}_elec_s{simpl}_{clusters}.nc"),
solar_thermal=resources("solar_thermal_total_elec_s{simpl}_{clusters}.nc"),
resources:
mem_mb=20000,
threads: 16
log:
logs("build_solar_thermal_profiles_{scope}_s{simpl}_{clusters}.log"),
logs("build_solar_thermal_profiles_total_s{simpl}_{clusters}.log"),
benchmark:
benchmarks("build_solar_thermal_profiles/{scope}_s{simpl}_{clusters}")
benchmarks("build_solar_thermal_profiles/total_s{simpl}_{clusters}")
conda:
"../envs/environment.yaml"
script:
Expand Down Expand Up @@ -1024,32 +1016,14 @@ rule prepare_sector_network:
"district_heat_share_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),
temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"),
temp_soil_rural=resources("temp_soil_rural_elec_s{simpl}_{clusters}.nc"),
temp_soil_urban=resources("temp_soil_urban_elec_s{simpl}_{clusters}.nc"),
temp_air_total=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"),
temp_air_rural=resources("temp_air_rural_elec_s{simpl}_{clusters}.nc"),
temp_air_urban=resources("temp_air_urban_elec_s{simpl}_{clusters}.nc"),
cop_soil_total=resources("cop_soil_total_elec_s{simpl}_{clusters}.nc"),
cop_soil_rural=resources("cop_soil_rural_elec_s{simpl}_{clusters}.nc"),
cop_soil_urban=resources("cop_soil_urban_elec_s{simpl}_{clusters}.nc"),
cop_air_total=resources("cop_air_total_elec_s{simpl}_{clusters}.nc"),
cop_air_rural=resources("cop_air_rural_elec_s{simpl}_{clusters}.nc"),
cop_air_urban=resources("cop_air_urban_elec_s{simpl}_{clusters}.nc"),
solar_thermal_total=lambda w: (
resources("solar_thermal_total_elec_s{simpl}_{clusters}.nc")
if config_provider("sector", "solar_thermal")(w)
else []
),
solar_thermal_urban=lambda w: (
resources("solar_thermal_urban_elec_s{simpl}_{clusters}.nc")
if config_provider("sector", "solar_thermal")(w)
else []
),
solar_thermal_rural=lambda w: (
resources("solar_thermal_rural_elec_s{simpl}_{clusters}.nc")
if config_provider("sector", "solar_thermal")(w)
else []
),
egs_potentials=lambda w: (
resources("egs_potentials_s{simpl}_{clusters}.csv")
if config_provider("sector", "enhanced_geothermal", "enable")(w)
Expand Down
19 changes: 5 additions & 14 deletions scripts/build_cop_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,12 @@
Inputs:
-------
- ``resources/<run_name>/temp_soil_total_elec_s<simpl>_<clusters>.nc``: Soil temperature (total) time series.
- ``resources/<run_name>/temp_soil_rural_elec_s<simpl>_<clusters>.nc``: Soil temperature (rural) time series.
- ``resources/<run_name>/temp_soil_urban_elec_s<simpl>_<clusters>.nc``: Soil temperature (urban) time series.
- ``resources/<run_name>/temp_air_total_elec_s<simpl>_<clusters>.nc``: Ambient air temperature (total) time series.
- ``resources/<run_name>/temp_air_rural_elec_s<simpl>_<clusters>.nc``: Ambient air temperature (rural) time series.
- ``resources/<run_name>/temp_air_urban_elec_s<simpl>_<clusters>.nc``: Ambient air temperature (urban) time series.

Outputs:
--------
- ``resources/cop_soil_total_elec_s<simpl>_<clusters>.nc``: COP (ground-sourced) time series (total).
- ``resources/cop_soil_rural_elec_s<simpl>_<clusters>.nc``: COP (ground-sourced) time series (rural).
- ``resources/cop_soil_urban_elec_s<simpl>_<clusters>.nc``: COP (ground-sourced) time series (urban).
- ``resources/cop_air_total_elec_s<simpl>_<clusters>.nc``: COP (air-sourced) time series (total).
- ``resources/cop_air_rural_elec_s<simpl>_<clusters>.nc``: COP (air-sourced) time series (rural).
- ``resources/cop_air_urban_elec_s<simpl>_<clusters>.nc``: COP (air-sourced) time series (urban).


References
Expand Down Expand Up @@ -67,12 +59,11 @@ def coefficient_of_performance(delta_T, source="air"):

set_scenario_config(snakemake)

for area in ["total", "urban", "rural"]:
for source in ["air", "soil"]:
source_T = xr.open_dataarray(snakemake.input[f"temp_{source}_{area}"])
for source in ["air", "soil"]:
source_T = xr.open_dataarray(snakemake.input[f"temp_{source}_total"])

delta_T = snakemake.params.heat_pump_sink_T - source_T
delta_T = snakemake.params.heat_pump_sink_T - source_T

cop = coefficient_of_performance(delta_T, source)
cop = coefficient_of_performance(delta_T, source)

cop.to_netcdf(snakemake.output[f"cop_{source}_{area}"])
cop.to_netcdf(snakemake.output[f"cop_{source}_total"])
4 changes: 2 additions & 2 deletions scripts/build_hourly_heat_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
------

- ``data/heat_load_profile_BDEW.csv``: Intraday heat profile for water and space heating demand for the residential and services sectors for weekends and weekdays.
- ``resources/daily_heat_demand_<scope>_elec_s<simpl>_<clusters>.nc``: Daily heat demand per cluster.
- ``resources/daily_heat_demand_total_elec_s<simpl>_<clusters>.nc``: Daily heat demand per cluster.

Outputs
-------

- ``resources/hourly_heat_demand_<scope>_elec_s<simpl>_<clusters>.nc``:
- ``resources/hourly_heat_demand_total_elec_s<simpl>_<clusters>.nc``:
"""

from itertools import product
Expand Down
6 changes: 3 additions & 3 deletions scripts/build_temperature_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
Inputs
------

- ``resources/<run_name>/pop_layout_<scope>.nc``:
- ``resources/<run_name>/pop_layout_total.nc``:
- ``resources/<run_name>/regions_onshore_elec_s<simpl>_<clusters>.geojson``:
- ``cutout``: Weather data cutout, as specified in config

Outputs
-------

- ``resources/temp_soil_<scope>_elec_s<simpl>_<clusters>.nc``:
- ``resources/temp_air_<scope>_elec_s<simpl>_<clusters>.nc`
- ``resources/temp_soil_total_elec_s<simpl>_<clusters>.nc``:
- ``resources/temp_air_total_elec_s<simpl>_<clusters>.nc`
"""

import atlite
Expand Down
Loading