Skip to content

drop non buses#1600

Merged
fneum merged 1 commit intoPyPSA:masterfrom
pworschischek-aggmag:fix-plot-gas-network-for-pypsa-de
Mar 23, 2025
Merged

drop non buses#1600
fneum merged 1 commit intoPyPSA:masterfrom
pworschischek-aggmag:fix-plot-gas-network-for-pypsa-de

Conversation

@pworschischek-aggmag
Copy link
Copy Markdown
Contributor

Closes #1599.

Changes proposed in this Pull Request

Drop link indices not in n.buses to prevent the script from failing with a KeyError. In principle, this applies the same logic as plot_power_network.py:126

# drop non-bus
to_drop = costs.index.levels[0].symmetric_difference(n.buses.index)
if len(to_drop) != 0:
    logger.info(f"Dropping non-buses {to_drop.tolist()}")
    costs.drop(to_drop, level=0, inplace=True, axis=0, errors="ignore")

where non-buses are being dropped already.

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in config/config.default.yaml.
  • Changes in configuration options are documented in doc/configtables/*.csv.
  • Sources of newly added data are documented in doc/data_sources.rst.
  • A release note doc/release_notes.rst is added.

@fneum fneum merged commit 1c4b186 into PyPSA:master Mar 23, 2025
12 checks passed
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.

Global buses "EU" and "DE" cause CH4 network plots to fail

2 participants