diff --git a/doc/release_notes.rst b/doc/release_notes.rst index e60f4f95..d6072d7d 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) ===================================== diff --git a/rules/build_sector.smk b/rules/build_sector.smk index d41ab528..466d1713 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,6 +837,7 @@ 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, retro_cost=lambda w: ( @@ -882,8 +891,6 @@ rule prepare_sector_network: if config_provider("foresight")(w) == "overnight" else resources("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 e56ce627..9a9db36f 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -453,7 +453,9 @@ def update_wind_solar_costs(n, costs): # code adapted from pypsa-eur/scripts/add_electricity.py for connection in ["dc", "ac"]: tech = "offwind-" + connection - profile = snakemake.input["profile_offwind_" + connection] + if tech not in n.generators.carrier.values: + continue + profile = snakemake.input["profile_offwind-" + connection] with xr.open_dataset(profile) as ds: # if-statement for compatibility with old profiles