Skip to content

Allow allow subregional NUTS selection.#2146

Open
bobbyxng wants to merge 6 commits into
PyPSA:masterfrom
resilient-project:subregions
Open

Allow allow subregional NUTS selection.#2146
bobbyxng wants to merge 6 commits into
PyPSA:masterfrom
resilient-project:subregions

Conversation

@bobbyxng
Copy link
Copy Markdown
Collaborator

Changes proposed in this Pull Request

  • Extension of NUTS administrative clustering
  • Allows a more fine-grained resolution with NUTS regions, e.g. "DEA" at level 3, while the neighbouring NUTS regions within DE are level 1 or 2 for example
image

Checklist

Required:

  • Changes are tested locally and behave as expected.
  • Code and workflow changes are documented.
  • A release note entry is added to doc/release_notes.rst.

If applicable:

  • Changes in configuration options are reflected in scripts/lib/validation.
  • For new data sources or versions, these instructions have been followed.
  • New rules are documented in the appropriate doc/*.rst files.

@bobbyxng bobbyxng requested a review from fneum April 13, 2026 12:16
@bobbyxng bobbyxng self-assigned this Apr 13, 2026
Copy link
Copy Markdown
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great in general. Two questions.

Could you test for a few administrative clustering cases (also not using the new feature), just to be sure it doesn't break anything? Cheers!

Comment thread scripts/base_network.py
subregion_level = {
k: v
for k, v in countries_config.items()
if len(k) > 2 and k[:2] in countries
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that also work for the UK, where it shows up as GB in country list but NUTS codes are UK...?

Comment thread scripts/base_network.py
# Only keep the values whose keys are in countries
countries_config = admin_levels.get("countries", {})
country_level = {
k: v for k, v in admin_levels.items() if (k != "level") and (k in countries)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it still be necessary to filter out the "level" here? Why can it be removed?

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