smaller fixes and reduction of diff

This commit is contained in:
Fabian Neumann 2024-03-04 19:36:41 +01:00
parent 92922728d8
commit 9d913bcb38
10 changed files with 20 additions and 41 deletions

View File

@ -1,5 +1,4 @@
,Unit,Values,Description ,Unit,Values,Description
url,--,string,"Link to open power system data time series data."
power_statistics,bool,"{true, false}",Whether to load the electricity consumption data of the ENTSOE power statistics (only for files from 2019 and before) or from the ENTSOE transparency data (only has load data from 2015 onwards). power_statistics,bool,"{true, false}",Whether to load the electricity consumption data of the ENTSOE power statistics (only for files from 2019 and before) or from the ENTSOE transparency data (only has load data from 2015 onwards).
interpolate_limit,hours,integer,"Maximum gap size (consecutive nans) which interpolated linearly." interpolate_limit,hours,integer,"Maximum gap size (consecutive nans) which interpolated linearly."
time_shift_for_large_gaps,string,string,"Periods which are used for copying time-slices in order to fill large gaps of nans. Have to be valid ``pandas`` period strings." time_shift_for_large_gaps,string,string,"Periods which are used for copying time-slices in order to fill large gaps of nans. Have to be valid ``pandas`` period strings."

1 Unit Values Description
url -- string Link to open power system data time series data.
2 power_statistics bool {true, false} Whether to load the electricity consumption data of the ENTSOE power statistics (only for files from 2019 and before) or from the ENTSOE transparency data (only has load data from 2015 onwards).
3 interpolate_limit hours integer Maximum gap size (consecutive nans) which interpolated linearly.
4 time_shift_for_large_gaps string string Periods which are used for copying time-slices in order to fill large gaps of nans. Have to be valid ``pandas`` period strings.

View File

@ -409,7 +409,7 @@ rule build_line_rating:
def input_profile_tech(w): def input_profile_tech(w):
return { return {
f"profile_{tech}": resources(f"profile{}_{tech}.nc") f"profile_{tech}": resources(f"profile_{tech}.nc")
for tech in config_provider("electricity", "renewable_carriers")(w) for tech in config_provider("electricity", "renewable_carriers")(w)
} }
@ -496,9 +496,7 @@ rule simplify_network:
output: output:
network=resources("networks/elec_s{simpl}.nc"), network=resources("networks/elec_s{simpl}.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}.geojson"), regions_onshore=resources("regions_onshore_elec_s{simpl}.geojson"),
regions_offshore=resources( regions_offshore=resources("regions_offshore_elec_s{simpl}.geojson"),
"regions_offshore_elec_s{simpl}.geojson"
),
busmap=resources("busmap_elec_s{simpl}.csv"), busmap=resources("busmap_elec_s{simpl}.csv"),
connection_costs=resources("connection_costs_s{simpl}.csv"), connection_costs=resources("connection_costs_s{simpl}.csv"),
log: log:
@ -532,9 +530,7 @@ rule cluster_network:
input: input:
network=resources("networks/elec_s{simpl}.nc"), network=resources("networks/elec_s{simpl}.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}.geojson"), regions_onshore=resources("regions_onshore_elec_s{simpl}.geojson"),
regions_offshore=resources( regions_offshore=resources("regions_offshore_elec_s{simpl}.geojson"),
"regions_offshore_elec_s{simpl}.geojson"
),
busmap=ancient(resources("busmap_elec_s{simpl}.csv")), busmap=ancient(resources("busmap_elec_s{simpl}.csv")),
custom_busmap=lambda w: ( custom_busmap=lambda w: (
"data/custom_busmap_elec_s{simpl}_{clusters}.csv" "data/custom_busmap_elec_s{simpl}_{clusters}.csv"
@ -546,12 +542,8 @@ rule cluster_network:
), ),
output: output:
network=resources("networks/elec_s{simpl}_{clusters}.nc"), network=resources("networks/elec_s{simpl}_{clusters}.nc"),
regions_onshore=resources( regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
"regions_onshore_elec_s{simpl}_{clusters}.geojson" regions_offshore=resources("regions_offshore_elec_s{simpl}_{clusters}.geojson"),
),
regions_offshore=resources(
"regions_offshore_elec_s{simpl}_{clusters}.geojson"
),
busmap=resources("busmap_elec_s{simpl}_{clusters}.csv"), busmap=resources("busmap_elec_s{simpl}_{clusters}.csv"),
linemap=resources("linemap_elec_s{simpl}_{clusters}.csv"), linemap=resources("linemap_elec_s{simpl}_{clusters}.csv"),
log: log:
@ -615,15 +607,9 @@ rule prepare_network:
output: output:
resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"), resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"),
log: log:
logs( logs("prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"),
"prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"
),
benchmark: benchmark:
( (benchmarks("prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"))
benchmarks(
"prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"
)
)
threads: 1 threads: 1
resources: resources:
mem_mb=4000, mem_mb=4000,

View File

@ -160,9 +160,9 @@ rule build_daily_heat_demand:
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_{scope}_{simpl}_{clusters}.loc"),
benchmark: benchmark:
benchmarks("build_daily_heat_demand/{scope}__s{simpl}_{clusters}") benchmarks("build_daily_heat_demand/{scope}_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -206,9 +206,9 @@ rule build_temperature_profiles:
mem_mb=20000, mem_mb=20000,
threads: 8 threads: 8
log: log:
logs("build_temperature_profiles_{scope}__{simpl}_{clusters}.log"), logs("build_temperature_profiles_{scope}_{simpl}_{clusters}.log"),
benchmark: benchmark:
benchmarks("build_temperature_profiles/{scope}__s{simpl}_{clusters}") benchmarks("build_temperature_profiles/{scope}_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -272,9 +272,9 @@ rule build_solar_thermal_profiles:
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_{scope}_s{simpl}_{clusters}.log"),
benchmark: benchmark:
benchmarks("build_solar_thermal_profiles/{scope}__s{simpl}_{clusters}") benchmarks("build_solar_thermal_profiles/{scope}_s{simpl}_{clusters}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -853,7 +853,7 @@ rule build_existing_heating_distribution:
def input_profile_offwind(w): def input_profile_offwind(w):
return { return {
f"profile_{tech}": resources(f"profile{}_{tech}.nc") f"profile_{tech}": resources(f"profile_{tech}.nc")
for tech in ["offwind-ac", "offwind-dc"] for tech in ["offwind-ac", "offwind-dc"]
if (tech in config_provider("electricity", "renewable_carriers")(w)) if (tech in config_provider("electricity", "renewable_carriers")(w))
} }

View File

@ -297,7 +297,7 @@ rule plot_elec_statistics:
output: output:
**{ **{
f"{plot}_bar": RESULTS f"{plot}_bar": RESULTS
+ f"figures/statistics_{plot}_bar_elec{}_s{{simpl}}_{{clusters}}_ec_l{{ll}}_{{opts}}.pdf" + f"figures/statistics_{plot}_bar_elec_s{{simpl}}_{{clusters}}_ec_l{{ll}}_{{opts}}.pdf"
for plot in STATISTICS_BARPLOTS for plot in STATISTICS_BARPLOTS
}, },
barplots_touch=RESULTS barplots_touch=RESULTS

View File

@ -35,7 +35,6 @@ if __name__ == "__main__":
district_heat_share = pd.read_csv(snakemake.input.district_heat_share, index_col=0)[ district_heat_share = pd.read_csv(snakemake.input.district_heat_share, index_col=0)[
"district heat share" "district heat share"
] ]
district_heat_share = district_heat_share.groupby("country").max()
# make ct-based share nodal # make ct-based share nodal
district_heat_share = district_heat_share.reindex(pop_layout.ct).fillna(0) district_heat_share = district_heat_share.reindex(pop_layout.ct).fillna(0)

View File

@ -15,7 +15,6 @@ if __name__ == "__main__":
snakemake = mock_snakemake( snakemake = mock_snakemake(
"build_industrial_energy_demand_per_node", "build_industrial_energy_demand_per_node",
weather_year="",
simpl="", simpl="",
clusters=48, clusters=48,
planning_horizons=2030, planning_horizons=2030,

View File

@ -23,7 +23,7 @@ if __name__ == "__main__":
config = snakemake.config["energy"] config = snakemake.config["energy"]
if snakemake.wildcards.kind == "heat": if snakemake.wildcards.kind == "heat":
years = pd.date_range(freq="YE", **snakemake.config["snapshots"]).year years = pd.date_range(freq="YE", **snakemake.params.snapshots).year
assert len(years) == 1, "Currently only works for single year." assert len(years) == 1, "Currently only works for single year."
data_year = years[0] data_year = years[0]
else: else:

View File

@ -34,8 +34,8 @@ Inputs
- ``resources/regions_onshore_elec_s{simpl}.geojson``: confer :ref:`simplify` - ``resources/regions_onshore_elec_s{simpl}.geojson``: confer :ref:`simplify`
- ``resources/regions_offshore_elec_s{simpl}.geojson``: confer :ref:`simplify` - ``resources/regions_offshore_elec_s{simpl}.geojson``: confer :ref:`simplify`
- ``networks/elec_s{simpl}.nc``: confer :ref:`simplify`
- ``resources/busmap_elec_s{simpl}.csv``: confer :ref:`simplify` - ``resources/busmap_elec_s{simpl}.csv``: confer :ref:`simplify`
- ``networks/elec_s{simpl}.nc``: confer :ref:`simplify`
- ``data/custom_busmap_elec_s{simpl}_{clusters}.csv``: optional input - ``data/custom_busmap_elec_s{simpl}_{clusters}.csv``: optional input
Outputs Outputs
@ -454,11 +454,7 @@ if __name__ == "__main__":
if "snakemake" not in globals(): if "snakemake" not in globals():
from _helpers import mock_snakemake from _helpers import mock_snakemake
snakemake = mock_snakemake( snakemake = mock_snakemake("cluster_network", simpl="", clusters="5")
"cluster_network",
simpl="",
clusters="5",
)
configure_logging(snakemake) configure_logging(snakemake)
set_scenario_config(snakemake) set_scenario_config(snakemake)

View File

@ -681,7 +681,7 @@ if __name__ == "__main__":
networks_dict = { networks_dict = {
(cluster, ll, opt + sector_opt, planning_horizon): "results/" (cluster, ll, opt + sector_opt, planning_horizon): "results/"
+ snakemake.params.RDIR + snakemake.params.RDIR
+ f"postnetworks/elec_s{simpl}_{cluster}_l{ll}_{opt}_{sector_opt}_{planning_horizon}.nc" + f"/postnetworks/elec_s{simpl}_{cluster}_l{ll}_{opt}_{sector_opt}_{planning_horizon}.nc"
for simpl in snakemake.params.scenario["simpl"] for simpl in snakemake.params.scenario["simpl"]
for cluster in snakemake.params.scenario["clusters"] for cluster in snakemake.params.scenario["clusters"]
for opt in snakemake.params.scenario["opts"] for opt in snakemake.params.scenario["opts"]

View File

@ -65,7 +65,7 @@ Outputs
.. image:: img/regions_offshore_elec_s .png .. image:: img/regions_offshore_elec_s .png
:scale: 33 % :scale: 33 %
- ``resources/busmap_elec_s{simpl}.h5``: Mapping of buses from ``networks/elec.nc`` to ``networks/elec_s{simpl}.nc``; has keys ['/busmap_s'] - ``resources/busmap_elec_s{simpl}.csv``: Mapping of buses from ``networks/elec.nc`` to ``networks/elec_s{simpl}.nc``;
- ``networks/elec_s{simpl}.nc``: - ``networks/elec_s{simpl}.nc``:
.. image:: img/elec_s.png .. image:: img/elec_s.png