Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align structure of the components with PyPSA consistency checks #1315

Merged
merged 5 commits into from
Jan 21, 2025

Conversation

ekatef
Copy link
Member

@ekatef ekatef commented Jan 21, 2025

A possible solution of the issues caused by AssertionErrors in PyPSA, like #1308.

Changes proposed in this Pull Request

The updated PyPSA version has more strict requirements towards the component structure which can easily lead to errors in case when n.lines and n.buses contains any "extra" fields. The PR aims to drop all the columns after base_network to make the workflow more robust.

Checklist

  • I consent to the release of this PR's code under the AGPLv3 license and non-code contributions under CC0-1.0 and CC-BY-4.0.
  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Newly introduced dependencies are added to envs/environment.yaml and doc/requirements.txt.
  • Changes in configuration options are added in all of config.default.yaml and config.tutorial.yaml.
  • Add a test config or line additions to test/ (note tests are changing the config.tutorial.yaml)
  • Changes in configuration options are also documented in doc/configtables/*.csv and line references are adjusted in doc/configuration.rst and doc/tutorial.rst.
  • A note for the release notes doc/release_notes.rst is amended in the format of previous release notes, including reference to the requested PR.

@ekatef ekatef changed the title Align structure of the components with PyPSa consistency checks Align structure of the components with PyPSA consistency checks Jan 21, 2025
@ekatef ekatef mentioned this pull request Jan 21, 2025
2 tasks
Copy link
Member

@davide-f davide-f left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this!
A possible comment and we are ready to go!
Please add a line in the release note

@@ -492,6 +492,10 @@ def base_network(
lines_ac = lines[lines.tag_frequency.astype(float) != 0].copy()
lines_dc = lines[lines.tag_frequency.astype(float) == 0].copy()

# avoiding the conflicts in processing the network model
Copy link
Member

Choose a reason for hiding this comment

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

Instead of dropping tag_frequency here, we could drop it in build_osm_nwtwork and rely on the "dc" column in base_networl instead.
What do you think?

In build osm, we have both the dc and tag_frequency columns that are passed to base_network.
Probably, we can drop tag frequency in build and rely on dc column

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, I see! We now have calculation of dc column directly in clean_osm script, so it's basically a duplication in base_network! Agree, no need then to keep tag_frequency up to base_network. Thanks a lot for checking it!

Revised 🙂

@davide-f davide-f merged commit 7d83f35 into pypsa-meets-earth:main Jan 21, 2025
7 checks passed
@davide-f
Copy link
Member

Thanks @ekatef :D
Merged

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