From 1151182ef1efaeba2e42f0dc2177ab4cf32593f6 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 7 Oct 2026 16:14:34 +0200 Subject: [PATCH 1/2] Fix loss of units with same name and prepare release 0.9.1 Remove the name-based drop_duplicates in powerplants(). It was a no-op until #317 assigned its result. It then kept only one unit per wind park in MaStR, which removed 77% of the German wind capacity in v0.9.0. Co-Authored-By: Claude Opus 5.5 --- docs/release-notes.md | 5 +++++ powerplantmatching/collection.py | 9 --------- test/test_collection.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 test/test_collection.py diff --git a/docs/release-notes.md b/docs/release-notes.md index 1f1f48a0..d5ff0fec 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -10,6 +10,11 @@ SPDX-License-Identifier: MIT * +## [v0.9.1](https://github.com/PyPSA/powerplantmatching/releases/tag/v0.9.1) (7th October 2026) + +* Bugfix: `pm.powerplants()` no longer drops entries that share name, fuel type and country. In v0.9.0, this removed all but one unit of each wind park in the Marktstammdatenregister. The operating wind capacity in Germany fell from 77 GW to 18 GW, and biogas from 7 GW to 3 GW. ([PR #PRNUM](https://github.com/PyPSA/powerplantmatching/pull/PRNUM)) +* For OPSD EU, use the most specific fuel classification (`energy_source_level_3`) for `Fueltype` when available. Correct the capacity of Borssele 1 nuclear power plant to the net value of 485 MW. ([PR #288](https://github.com/PyPSA/powerplantmatching/pull/288)) + ## [v0.9.0](https://github.com/PyPSA/powerplantmatching/releases/tag/v0.9.0) (3rd October 2026) * Updated BEYONDCOAL, IRENASTAT, ENTSOE, JRC, Marktstammdatenregister (August 2026), European Energy Storage Inventory and the Global Energy Monitor datasets (oil and gas, coal, geothermal, nuclear, hydropower) to the latest versions. ([PR #319](https://github.com/PyPSA/powerplantmatching/pull/319)) diff --git a/powerplantmatching/collection.py b/powerplantmatching/collection.py index a677ae52..5e462f5c 100644 --- a/powerplantmatching/collection.py +++ b/powerplantmatching/collection.py @@ -243,15 +243,6 @@ def powerplants( else: matched = matched[matched.lat.notnull()] - if isinstance(matched.columns, pd.MultiIndex): - matched = ( - matched.stack(future_stack=True) - .drop_duplicates(["Name", "Fueltype", "Country"]) - .unstack(-1) - ) - else: - matched = matched.drop_duplicates(["Name", "Fueltype", "Country"]) - matched.reset_index(drop=True).to_csv(fn, index_label="id", encoding="utf-8") if extend_by_vres: diff --git a/test/test_collection.py b/test/test_collection.py new file mode 100644 index 00000000..1d54a99e --- /dev/null +++ b/test/test_collection.py @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Contributors to powerplantmatching +# +# SPDX-License-Identifier: MIT + +import pandas as pd + +import powerplantmatching as pm +from powerplantmatching import collection + + +def test_powerplants_keeps_units_with_same_name(monkeypatch): + turbines = pd.DataFrame( + { + "Name": ["Windpark Nord", "Windpark Nord"], + "Fueltype": "Wind", + "Country": "Germany", + "Capacity": [3.0, 4.0], + "lat": [54.0, 54.1], + "lon": [9.0, 9.1], + "projectID": [{"MASTR": {"SEE1"}}, {"MASTR": {"SEE2"}}], + } + ) + monkeypatch.setattr(collection, "collect", lambda *args, **kwargs: turbines) + config = pm.get_config(fully_included_sources=[], variant="test-same-name") + + df = pm.powerplants(config=config, update=True, fill_geopositions=False) + + assert df.Capacity.sum() == turbines.Capacity.sum() From 83319a4dab48808e10d13e88ecff3460a2c04a2b Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 7 Oct 2026 16:14:53 +0200 Subject: [PATCH 2/2] Add PR number to release notes Co-Authored-By: Claude Opus 5.5 --- docs/release-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index d5ff0fec..c30d2159 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -12,7 +12,7 @@ SPDX-License-Identifier: MIT ## [v0.9.1](https://github.com/PyPSA/powerplantmatching/releases/tag/v0.9.1) (7th October 2026) -* Bugfix: `pm.powerplants()` no longer drops entries that share name, fuel type and country. In v0.9.0, this removed all but one unit of each wind park in the Marktstammdatenregister. The operating wind capacity in Germany fell from 77 GW to 18 GW, and biogas from 7 GW to 3 GW. ([PR #PRNUM](https://github.com/PyPSA/powerplantmatching/pull/PRNUM)) +* Bugfix: `pm.powerplants()` no longer drops entries that share name, fuel type and country. In v0.9.0, this removed all but one unit of each wind park in the Marktstammdatenregister. The operating wind capacity in Germany fell from 77 GW to 18 GW, and biogas from 7 GW to 3 GW. ([PR #328](https://github.com/PyPSA/powerplantmatching/pull/328)) * For OPSD EU, use the most specific fuel classification (`energy_source_level_3`) for `Fueltype` when available. Correct the capacity of Borssele 1 nuclear power plant to the net value of 485 MW. ([PR #288](https://github.com/PyPSA/powerplantmatching/pull/288)) ## [v0.9.0](https://github.com/PyPSA/powerplantmatching/releases/tag/v0.9.0) (3rd October 2026)