Skip to content

Fix: block aggregation for configured fuel types - #332

Open
lindnemi wants to merge 2 commits into
masterfrom
fix-block-splitting-config
Open

lindnemi wants to merge 2 commits into
masterfrom
fix-block-splitting-config

Conversation

@lindnemi

@lindnemi lindnemi commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted.

Problem

The configuration defines clean_name.fueltypes_with_blocks, but aggregate_units() looked up the misspelled key clean_name.fuel_type_with_blocks.

Because that key was absent, aggregation treated the list as empty and applied no fuel-type filter. As a result, fuels configured to retain block labels—Nuclear by default—were still eligible for aggregation. Units with matching plant names could be merged, even though name cleaning preserved their block labels.

Fix

Correct the spelling, further add a "not in" to the previously skipped query formulation and add a safeguard for empty lists.

Impact

With cached sources, the nuclear-only comparison showed 14 more matched entries (238 → 252) with reported capacity unchanged at 191,070 MW.

Copilot report

Nuclear block-aggregation impact

Compared the default nuclear matching workflow with aggregation exclusion disabled (the pre-fix behavior), against the same workflow with Nuclear in clean_name.fueltypes_with_blocks. Both runs retained nuclear block labels and used the current matching/source filters. The target was restricted to Nuclear; all 19 required input files were already cached, so no source data was downloaded.

Measure Before After Change
Matched nuclear entries 238 252 +14 (+5.9%)
Reported nuclear capacity 191,070 MW 191,070 MW 0 MW
Countries represented 18 18 0
Nuclear entries
Before  ████████████████████████  238
After   █████████████████████████ 252

Reported capacity
Before  ███████████████████ 191,070 MW
After   ███████████████████ 191,070 MW

Only France and the United Kingdom had different row counts:

Country Entries before → after Capacity before → after
France 70 → 72 (+2) 71,777 → 71,777 MW
United Kingdom 35 → 47 (+12) 19,137 → 19,137 MW

For example, Dungeness A changed from one 460 MW entry to two 230 MW entries (A1 and A2). Other source memberships also shifted (ENTSOE-linked rows 92 → 89; OPSD-linked rows 97 → 104), consistent with changed matching granularity.

Interpretation: With these cached inputs and the current source filters, enabling nuclear block exclusion adds 14 matched entries without increasing total reported nuclear capacity. This is a granularity change, not a retirement-accounting fix or a general guarantee against overlapping capacity in other configurations.

Reproduction: Run pm.powerplants(..., update=True, fill_geopositions=False, filter_missing_geopositions=False) twice with target_fueltypes restricted to Nuclear and distinct output hashes. For the before case, disable only the aggregation exclusion lookup; keep the default Nuclear block-name handling. For the after case, use fueltypes_with_blocks: [Nuclear].

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in docs.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes docs/release_notes.md of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license and have added my name to the docs/contributors.md.

@lindnemi
lindnemi requested a review from fneum October 16, 2026 08:53
@fneum

fneum commented Oct 16, 2026

Copy link
Copy Markdown
Member

Yes, also included I think in #326

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants