From ccb43a5612010d13db0b000dfabab673cd900aeb Mon Sep 17 00:00:00 2001 From: Koen van Greevenbroek Date: Mon, 19 Feb 2024 22:45:17 +0100 Subject: [PATCH 1/4] Allow absence of offshore wind from sector-coupled networks --- rules/build_sector.smk | 7 +++++-- scripts/prepare_sector_network.py | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rules/build_sector.smk b/rules/build_sector.smk index acdc32033..ff25af0e2 100644 --- a/rules/build_sector.smk +++ b/rules/build_sector.smk @@ -808,6 +808,11 @@ rule prepare_sector_network: **rules.cluster_gas_network.output, **rules.build_gas_input_locations.output, **build_sequestration_potentials_output, + **{ + f"profile_offwind_{tech}": RESOURCES + f"profile_offwind-{tech}.nc" + for tech in ["ac", "dc"] + if (f"offwind-{tech}" in config["electricity"]["renewable_carriers"]) + }, network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", energy_totals_name=RESOURCES + "energy_totals.csv", eurostat=input_eurostat, @@ -833,8 +838,6 @@ rule prepare_sector_network: if config["foresight"] == "overnight" else "data/costs_{planning_horizons}.csv" ), - profile_offwind_ac=RESOURCES + "profile_offwind-ac.nc", - profile_offwind_dc=RESOURCES + "profile_offwind-dc.nc", h2_cavern=RESOURCES + "salt_cavern_potentials_s{simpl}_{clusters}.csv", busmap_s=RESOURCES + "busmap_elec_s{simpl}.csv", busmap=RESOURCES + "busmap_elec_s{simpl}_{clusters}.csv", diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index b1351089c..21728f7cc 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -423,6 +423,8 @@ def update_wind_solar_costs(n, costs): # code adapted from pypsa-eur/scripts/add_electricity.py for connection in ["dc", "ac"]: tech = "offwind-" + connection + if tech not in n.generators.carrier.values: + continue profile = snakemake.input["profile_offwind_" + connection] with xr.open_dataset(profile) as ds: From ef29be714ba96807bb6825066bb81dcf198b7b07 Mon Sep 17 00:00:00 2001 From: Koen van Greevenbroek Date: Tue, 20 Feb 2024 14:43:10 +0100 Subject: [PATCH 2/4] Add release note --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index e60f4f951..d6072d7d1 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -79,6 +79,8 @@ Upcoming Release * The outputs of the rule ``retrieve_gas_infrastructure_data`` no longer marked as ``protected()`` as the download size is small. +* Bugfix: allow modelling sector-coupled landlocked regions. (Fixed handling of offshore wind.) + PyPSA-Eur 0.10.0 (19th February 2024) ===================================== From 1c9845afff70f9e5e461dac0864e355a851c071b Mon Sep 17 00:00:00 2001 From: Koen van Greevenbroek Date: Tue, 20 Feb 2024 17:52:57 +0100 Subject: [PATCH 3/4] Adapt offwind solution to new config management --- rules/build_sector.smk | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rules/build_sector.smk b/rules/build_sector.smk index c7c4662d3..466d17137 100644 --- a/rules/build_sector.smk +++ b/rules/build_sector.smk @@ -808,6 +808,14 @@ rule build_existing_heating_distribution: "../scripts/build_existing_heating_distribution.py" +def input_profile_offwind(w): + return { + f"profile_{tech}": resources(f"profile_{tech}.nc") + for tech in ["offwind-ac", "offwind-dc"] + if (tech in config_provider("electricity", "renewable_carriers")(w)) + } + + rule prepare_sector_network: params: time_resolution=config_provider("clustering", "temporal", "resolution_sector"), @@ -829,13 +837,9 @@ rule prepare_sector_network: eurostat_report_year=config_provider("energy", "eurostat_report_year"), RDIR=RDIR, input: + unpack(input_profile_offwind), **rules.cluster_gas_network.output, **rules.build_gas_input_locations.output, - **{ - f"profile_offwind_{tech}": RESOURCES + f"profile_offwind-{tech}.nc" - for tech in ["ac", "dc"] - if (f"offwind-{tech}" in config["electricity"]["renewable_carriers"]) - }, retro_cost=lambda w: ( resources("retro_cost_elec_s{simpl}_{clusters}.csv") if config_provider("sector", "retrofitting", "retro_endogen")(w) From db9f234faddecb45f2b11498010f40ea084a6f75 Mon Sep 17 00:00:00 2001 From: Koen van Greevenbroek Date: Tue, 20 Feb 2024 18:38:21 +0100 Subject: [PATCH 4/4] Fix typo in snakemake input --- scripts/prepare_sector_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 6128b873b..9a9db36fa 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -455,7 +455,7 @@ def update_wind_solar_costs(n, costs): tech = "offwind-" + connection if tech not in n.generators.carrier.values: continue - profile = snakemake.input["profile_offwind_" + connection] + profile = snakemake.input["profile_offwind-" + connection] with xr.open_dataset(profile) as ds: # if-statement for compatibility with old profiles