From 95094bec1425ed791f4587aa159fd7cad5bcefa3 Mon Sep 17 00:00:00 2001 From: Michael Lindner Date: Fri, 16 Oct 2026 10:45:46 +0200 Subject: [PATCH 1/2] fix typo in config key --- docs/release-notes.md | 2 +- powerplantmatching/cleaning.py | 9 ++++++--- powerplantmatching/package_data/config.yaml | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index c30d2159..f6e4150f 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,7 +8,7 @@ SPDX-License-Identifier: MIT ## Upcoming Version -* +* Fix typo in `clean_name.fueltypes_with_blocks`: listed fuels are now excluded from aggregation, rather than the setting being partially ignored due to the misspelled key. Nuclear units therefore remain separate by default. Empty lists allow all fuels to be aggregated and no longer cause an error during name cleaning. ## [v0.9.1](https://github.com/PyPSA/powerplantmatching/releases/tag/v0.9.1) (7th October 2026) diff --git a/powerplantmatching/cleaning.py b/powerplantmatching/cleaning.py index fbe80c74..8dd361e7 100644 --- a/powerplantmatching/cleaning.py +++ b/powerplantmatching/cleaning.py @@ -124,7 +124,7 @@ def clean_name(df, config=None): # do not remove block letters for fuel types with blocks; the regular # regex \w would remove standalone letters, this one is skipped for # fueltypes in mask - elif key == "" and r"\w" in pattern: + elif len(keep_blocks) > 0 and key == "" and r"\w" in pattern: pattern_keep = r"(?i)" + "|".join( [rf"\b{p}\b" for p in pattern if p != r"\w"] ) @@ -439,6 +439,9 @@ def aggregate_units( up the capacity of powerplant units which are determined to belong to the same plant. + Fuel types listed in ``clean_name.fueltypes_with_blocks`` are excluded + from aggregation and remain singleton groups, regardless of their names. + Parameters ---------- df : pandas.Dataframe or string @@ -497,8 +500,8 @@ def aggregate_units( break block_query = None - if with_blocks := config["clean_name"].get("fuel_type_with_blocks", []): # noqa - block_query = "Fueltype in @with_blocks" + if with_blocks := config["clean_name"].get("fueltypes_with_blocks", []): # noqa: F841 + block_query = "Fueltype not in @with_blocks" if country_wise: countries = df.Country.unique() diff --git a/powerplantmatching/package_data/config.yaml b/powerplantmatching/package_data/config.yaml index 290fc401..774bf428 100644 --- a/powerplantmatching/package_data/config.yaml +++ b/powerplantmatching/package_data/config.yaml @@ -588,6 +588,8 @@ target_technologies: - op zee - zeewind clean_name: + # Preserve block labels in names and exclude these fuels from unit aggregation. + # An empty list removes block labels and allows all fuels to be aggregated. fueltypes_with_blocks: - Nuclear remove_common_words: false # remove words which appear more that 20 times in all entries From d209f21d5bdadf68affc6352945e200a3f3df9b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2026 08:52:43 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- 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 f6e4150f..2149f886 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,7 +8,7 @@ SPDX-License-Identifier: MIT ## Upcoming Version -* Fix typo in `clean_name.fueltypes_with_blocks`: listed fuels are now excluded from aggregation, rather than the setting being partially ignored due to the misspelled key. Nuclear units therefore remain separate by default. Empty lists allow all fuels to be aggregated and no longer cause an error during name cleaning. +* Fix typo in `clean_name.fueltypes_with_blocks`: listed fuels are now excluded from aggregation, rather than the setting being partially ignored due to the misspelled key. Nuclear units therefore remain separate by default. Empty lists allow all fuels to be aggregated and no longer cause an error during name cleaning. ## [v0.9.1](https://github.com/PyPSA/powerplantmatching/releases/tag/v0.9.1) (7th October 2026)