remove {scope} wildcard (#1171)

* remove {scope} wildcard

* do not create removed files
This commit is contained in:
Fabian Neumann 2024-07-24 13:19:57 +02:00 committed by GitHub
parent 8b1b1144d5
commit eab315291e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 69 deletions

View File

@ -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`. * 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. * 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 * Updated pre-built `weather data cutouts

View File

@ -142,13 +142,6 @@ The ``{sector_opts}`` wildcard is only used for sector-coupling studies.
:widths: 10,20,10,10 :widths: 10,20,10,10
:file: configtables/sector-opts.csv :file: configtables/sector-opts.csv
.. _scope:
The ``{scope}`` wildcard
========================
Takes values ``residential``, ``urban``, ``total``.
.. _planning_horizons: .. _planning_horizons:
The ``{planning_horizons}`` wildcard The ``{planning_horizons}`` wildcard

View File

@ -151,18 +151,18 @@ rule build_daily_heat_demand:
snapshots=config_provider("snapshots"), snapshots=config_provider("snapshots"),
drop_leap_day=config_provider("enable", "drop_leap_day"), drop_leap_day=config_provider("enable", "drop_leap_day"),
input: 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"), regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
cutout=heat_demand_cutout, cutout=heat_demand_cutout,
output: 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: resources:
mem_mb=20000, mem_mb=20000,
threads: 8 threads: 8
log: log:
logs("build_daily_heat_demand_{scope}_{simpl}_{clusters}.loc"), logs("build_daily_heat_demand_total_{simpl}_{clusters}.loc"),
benchmark: benchmark:
benchmarks("build_daily_heat_demand/{scope}_s{simpl}_{clusters}") benchmarks("build_daily_heat_demand/total_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -175,16 +175,16 @@ rule build_hourly_heat_demand:
drop_leap_day=config_provider("enable", "drop_leap_day"), drop_leap_day=config_provider("enable", "drop_leap_day"),
input: input:
heat_profile="data/heat_load_profile_BDEW.csv", 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: 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: resources:
mem_mb=2000, mem_mb=2000,
threads: 8 threads: 8
log: log:
logs("build_hourly_heat_demand_{scope}_{simpl}_{clusters}.loc"), logs("build_hourly_heat_demand_total_{simpl}_{clusters}.loc"),
benchmark: benchmark:
benchmarks("build_hourly_heat_demand/{scope}_s{simpl}_{clusters}") benchmarks("build_hourly_heat_demand/total_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -196,19 +196,19 @@ rule build_temperature_profiles:
snapshots=config_provider("snapshots"), snapshots=config_provider("snapshots"),
drop_leap_day=config_provider("enable", "drop_leap_day"), drop_leap_day=config_provider("enable", "drop_leap_day"),
input: 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"), regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
cutout=heat_demand_cutout, cutout=heat_demand_cutout,
output: output:
temp_soil=resources("temp_soil_{scope}_elec_s{simpl}_{clusters}.nc"), temp_soil=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"),
temp_air=resources("temp_air_{scope}_elec_s{simpl}_{clusters}.nc"), temp_air=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"),
resources: resources:
mem_mb=20000, mem_mb=20000,
threads: 8 threads: 8
log: log:
logs("build_temperature_profiles_{scope}_{simpl}_{clusters}.log"), logs("build_temperature_profiles_total_{simpl}_{clusters}.log"),
benchmark: benchmark:
benchmarks("build_temperature_profiles/{scope}_s{simpl}_{clusters}") benchmarks("build_temperature_profiles/total_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -220,18 +220,10 @@ rule build_cop_profiles:
heat_pump_sink_T=config_provider("sector", "heat_pump_sink_T"), heat_pump_sink_T=config_provider("sector", "heat_pump_sink_T"),
input: input:
temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"), 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_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: output:
cop_soil_total=resources("cop_soil_total_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_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: resources:
mem_mb=20000, mem_mb=20000,
log: log:
@ -263,18 +255,18 @@ rule build_solar_thermal_profiles:
drop_leap_day=config_provider("enable", "drop_leap_day"), drop_leap_day=config_provider("enable", "drop_leap_day"),
solar_thermal=config_provider("solar_thermal"), solar_thermal=config_provider("solar_thermal"),
input: 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"), regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
cutout=solar_thermal_cutout, cutout=solar_thermal_cutout,
output: output:
solar_thermal=resources("solar_thermal_{scope}_elec_s{simpl}_{clusters}.nc"), solar_thermal=resources("solar_thermal_total_elec_s{simpl}_{clusters}.nc"),
resources: resources:
mem_mb=20000, mem_mb=20000,
threads: 16 threads: 16
log: log:
logs("build_solar_thermal_profiles_{scope}_s{simpl}_{clusters}.log"), logs("build_solar_thermal_profiles_total_s{simpl}_{clusters}.log"),
benchmark: benchmark:
benchmarks("build_solar_thermal_profiles/{scope}_s{simpl}_{clusters}") benchmarks("build_solar_thermal_profiles/total_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -1024,32 +1016,14 @@ rule prepare_sector_network:
"district_heat_share_elec_s{simpl}_{clusters}_{planning_horizons}.csv" "district_heat_share_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
), ),
temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"), 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_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_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_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: ( solar_thermal_total=lambda w: (
resources("solar_thermal_total_elec_s{simpl}_{clusters}.nc") resources("solar_thermal_total_elec_s{simpl}_{clusters}.nc")
if config_provider("sector", "solar_thermal")(w) if config_provider("sector", "solar_thermal")(w)
else [] 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: ( egs_potentials=lambda w: (
resources("egs_potentials_s{simpl}_{clusters}.csv") resources("egs_potentials_s{simpl}_{clusters}.csv")
if config_provider("sector", "enhanced_geothermal", "enable")(w) if config_provider("sector", "enhanced_geothermal", "enable")(w)

View File

@ -21,20 +21,12 @@ Relevant Settings
Inputs: Inputs:
------- -------
- ``resources/<run_name>/temp_soil_total_elec_s<simpl>_<clusters>.nc``: Soil temperature (total) time series. - ``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_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: Outputs:
-------- --------
- ``resources/cop_soil_total_elec_s<simpl>_<clusters>.nc``: COP (ground-sourced) time series (total). - ``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_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 References
@ -67,12 +59,11 @@ if __name__ == "__main__":
set_scenario_config(snakemake) set_scenario_config(snakemake)
for area in ["total", "urban", "rural"]:
for source in ["air", "soil"]: for source in ["air", "soil"]:
source_T = xr.open_dataarray(snakemake.input[f"temp_{source}_{area}"]) 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"])

View File

@ -22,12 +22,12 @@ Inputs
------ ------
- ``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. - ``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 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 from itertools import product

View File

@ -25,15 +25,15 @@ Relevant Settings
Inputs 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``: - ``resources/<run_name>/regions_onshore_elec_s<simpl>_<clusters>.geojson``:
- ``cutout``: Weather data cutout, as specified in config - ``cutout``: Weather data cutout, as specified in config
Outputs Outputs
------- -------
- ``resources/temp_soil_<scope>_elec_s<simpl>_<clusters>.nc``: - ``resources/temp_soil_total_elec_s<simpl>_<clusters>.nc``:
- ``resources/temp_air_<scope>_elec_s<simpl>_<clusters>.nc` - ``resources/temp_air_total_elec_s<simpl>_<clusters>.nc`
""" """
import atlite import atlite