Fix corine bool and offshore keyerror - #2113
Open
MarcoAnarmo wants to merge 7 commits into
Open
Conversation
When corine is set to false for offshore technologies, convert it to an empty dict so downstream 'key in corine' checks are skipped. Fixes PyPSA#2111
Filter availability matrix buses against clustered regions index to avoid KeyError when countries' offshore zones are dropped. Fixes PyPSA#2112
When clustering.simplify_network.to_380 is set to false, skip simplify_network_to_380() so that original voltage levels and transformers are preserved in the simplified network.
Add v_nom to custom_line_groupers so lines at different voltage levels are not merged. Pass with_country=True to cluster_regions so the output region shapefiles retain a country column for downstream scripts.
Use the 'country' column (when available) instead of slicing the first two characters of the bus name. Also subset sjoin to geometry-only to avoid extra columns and deduplicate plants in overlapping regions.
Write an empty availability matrix and exit early when no valid region geometries exist. Guard WDPA polygon/point reads behind geometry checks to prevent errors on empty GeoDataFrames.
for more information, see https://pre-commit.ci
Member
|
Could you divide the suggested changes into multiple separate PRs? Then we can decide / discuss one by one. Not all of them are related / dependent on each other. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2111 and #2112.
Changes proposed in this Pull Request
Fixes two detected bugs in the renewable availability/profiles pipeline when using offshore technologies with
corine: falseand non-standard country lists:determine_availability_matrix _MD_UA.py: Convertcorineto an empty dict when set to false, preventingTypeErroron"key" in corinechecks.build_renewable_profiles.py: Filter offshore buses against clustered regions index to avoidKeyErrorfor buses dropped during clustering.Used config file: config.osm_eem.yaml
Checklist
pixi.toml(usingpixi add <dependency-name>).config/config.default.yaml.doc/configtables/*.csv.doc/release_notes.rstis added.