Skip to content

Commit 164c9bb

Browse files
AFU3141FUHRMANEK Andreas (JRC-PETTEN) - fuhrandpre-commit-ci[bot]fneum
authored
Fix build_renewable_profiles.py for offshore regions with missing ons… (#2425)
* Fix build_renewable_profiles.py for offshore regions with missing onshore regions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * review: map offshore buses without onshore region to nearest onshore regions --------- Co-authored-by: FUHRMANEK Andreas (JRC-PETTEN) - fuhrand <fuhrand@nikola28.cluster> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
1 parent e094577 commit 164c9bb

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎doc/release_notes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
<!-- Upcoming Release -->
77
<!-- ================= -->
8+
* Fix: Offshore wind profiles no longer fail for clustered buses without an onshore region; the nearest onshore regions then serve as the shoreline ([#2425](https://github.com/PyPSA/pypsa-eur/pull/2425)).
89
* Fix: Hydro reservoir storage (`renewable: hydro: hydro_max_hours`) no longer depends on the first unit of each country, and the default now matches the country totals. This changes default results ([#2428](https://github.com/PyPSA/pypsa-eur/pull/2428)).
910
* data: Upgrade techno-economic assumptions to `technology-data` v0.16.0. This changes default results. Affected are nuclear fuel cost, `central solid biomass CHP CC` cost and efficiency, `waste CHP CC` (`industry: waste_to_energy_cc`) and `biogas to gas CC` ([#2426](https://github.com/PyPSA/pypsa-eur/pull/2426)).
1011
* Feature: Add enhanced rock weathering, biochar, afforestation and perennial grass as land-based carbon dioxide removal options (`sector: rock_weathering`, `sector: biochar`, `sector: afforestation`, `sector: perennials`). Their potentials derive from CORINE land cover or, for perennial grass, from the cropland freed by the phase-out of unsustainable bioliquids. ([#2405](https://github.com/PyPSA/pypsa-eur/pull/2405)) We acknowledge funding to Alberto Alamia from [CORC](https://corc.au.dk/).

‎scripts/build_renewable_profiles.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,18 @@
102102
regions = regions.set_index("name").rename_axis("bus")
103103
if snakemake.wildcards.technology.startswith("offwind"):
104104
# for offshore regions, the shortest distance to the shoreline is used
105-
offshore_regions = availability.coords["bus"].values
105+
offshore_regions = availability.coords["bus"].to_index()
106+
missing = offshore_regions.difference(regions.index)
107+
if not missing.empty:
108+
logger.info(
109+
f"Using nearest onshore regions as shoreline for {len(missing)} buses without onshore region."
110+
)
111+
offshore = gpd.read_file(snakemake.input.resource_regions).set_index("name")
112+
i, j = regions.to_crs(3035).sindex.nearest(
113+
offshore.loc[missing].to_crs(3035).geometry
114+
)
115+
shore = regions.iloc[j][["geometry"]].set_axis(missing[i])
116+
regions = pd.concat([regions, shore.dissolve(level=0)])
106117
regions = regions.loc[offshore_regions]
107118
regions = regions.map(lambda g: _simplify_polys(g, minarea=1)).set_crs(
108119
regions.crs

0 commit comments

Comments
 (0)