Skip to content

Bugfix: Make plot_balance_maps more robust, when inactive links exist#1626

Merged
fneum merged 3 commits intoPyPSA:masterfrom
resilient-project:fix-balance-maps
Apr 3, 2025
Merged

Bugfix: Make plot_balance_maps more robust, when inactive links exist#1626
fneum merged 3 commits intoPyPSA:masterfrom
resilient-project:fix-balance-maps

Conversation

@bobbyxng
Copy link
Copy Markdown
Collaborator

@bobbyxng bobbyxng commented Apr 2, 2025

Changes proposed in this Pull Request

  • Adding another check whether carriers in the solved network also exist in n.statistics.energy_balance()
  • Needed for those cases where inactive links (e.g. inactive CO2 pipelines) exist, but do not appear in energy balance. In this case, the previous workflow would break
carriers_in_eb = carriers[carriers.isin(eb.index.get_level_values("carrier"))]
eb.loc[components] = eb.loc[components].drop(index=carriers_in_eb, level="carrier")

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.

@bobbyxng bobbyxng requested review from fneum and p-glaum April 2, 2025 11:46
@fneum
Copy link
Copy Markdown
Member

fneum commented Apr 2, 2025

ruff check --fix

@fneum fneum merged commit 80557f5 into PyPSA:master Apr 3, 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.

3 participants