Skip to content

Enrich missing coordinates from JRC EIC references without capacity duplication - #324

Draft
MaykThewessen wants to merge 9 commits into
PyPSA:masterfrom
MaykThewessen:codex/upstream-python-linkage-jrc
Draft

MaykThewessen wants to merge 9 commits into
PyPSA:masterfrom
MaykThewessen:codex/upstream-python-linkage-jrc

Conversation

@MaykThewessen

@MaykThewessen MaykThewessen commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Use the historical JRC production/generation EIC reference to fill missing ENTSOE coordinates while preserving existing capacities and complete coordinate pairs. Keep latitude, longitude and provenance together through aggregation, reduction and cache reload. Ambiguous EIC locations remain unfilled.

Add the optional JRC_PPDB_OPEN loader with fuel normalization, both EIC identifier levels and production capacity counted once. For example, Eemshaven coal remains 1580 MW instead of 3160 MW. The historical reference is excluded from default matching and fully included sources.

This draft is stacked on #289 and the Python matcher follow-up #323. It addresses the capacity, source-name, fuel-normalization and identifier-loss problems reviewed in #306. The JRC version 1.00 archive has 7117 generation rows and 48 ambiguous EIC locations.

Validation: 64 focused tests pass on the extracted integration branch. The local 11-source build completed with 180064 records and 49 records with JRC coordinate provenance. It retains 45 unknown capacities; source vintages and planned/retired assets prevent interpreting totals as operational capacity or matcher accuracy. A reproducible validation runner is included. Local inventory artifacts remain outside this upstream PR.

MaykThewessen and others added 9 commits October 5, 2026 16:51
Implements the architecture proposed in PyPSA#287: deterministic matching on
EIC (Energy Identification Code) runs before Duke fuzzy matching in
compare_two_datasets(). Plants sharing an EIC code are matched with
certainty, then removed from the Duke input so the fuzzy matcher only
handles the residual.

This provides a robustness guarantee against co-located plant confusion.
For example, in the Eemshaven harbour area (Netherlands):

  OPSD "Eemscentrale Ec"  (Natural Gas, 1929 MW, 6 EIC codes)
  ENTSOE "Eems"           (Natural Gas, 1931 MW, same 6 EIC codes)
  ENTSOE "Eemshaven"      (Hard Coal,   1580 MW, different EIC)
  ENTSOE "Eemshaven"      (Natural Gas, 1410 MW, different EIC)

EIC matching deterministically pairs the gas plants via their shared
codes, preventing any possibility of Duke merging them with the nearby
coal plant based on name/geo similarity.

Similarly, Borssele nuclear (OPSD: 492 MW, ENTSOE: 485 MW) is locked
to its correct cross-source pair via EIC 49W000000000054X, independent
of fuzzy name matching against nearby Borssele wind/coal entries.

Integration test: 431 deterministic EIC matches between OPSD and ENTSOE
(28% of ENTSOE), reducing Duke's workload for those pairs to zero.

Closes PyPSA#287

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fneum

fneum commented Oct 7, 2026

Copy link
Copy Markdown
Member

See comment on #323. I'm happy to help bring in better EIC matching, but you need to make it easier to review your change requests, otherwise there will be little appetite from the maintainer side to review.

@MaykThewessen

Copy link
Copy Markdown
Contributor Author

Ah good comment, shall I break it up in smaller pieces?

Or shall I first comment on rapidfuzz #301?

@fneum

fneum commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Yes, smaller and independent pieces. It would be good to keep matching logic and data improvements separate.

@MaykThewessen

Copy link
Copy Markdown
Contributor Author

Plan:

Close this PR once those are up.

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