Skip to content

Simplify scenarios#84

Merged
lindnemi merged 15 commits intomainfrom
simplify-scenarios
May 15, 2025
Merged

Simplify scenarios#84
lindnemi merged 15 commits intomainfrom
simplify-scenarios

Conversation

@lindnemi
Copy link
Collaborator

@lindnemi lindnemi commented May 7, 2025

This PR:

  • Makes Mix the default scenario and changes pypsa.de.yaml accordingly
  • Simplifies the definition of existing scenarios, only the delta to Mix has to be specified explicitly
  • Makes scenario building more robust, e.g. an empty scenario defintion will now simply run the default config
  • Changes the syntax of the national_co2_budget configuration to comply with that of other constraints

Before asking for a review for this PR make sure to complete the following checklist:

  • Workflow with target rule ariadne_all completes without errors
  • The logic of export_ariadne_variables has been adapted to the changes
  • One or several figures that validate the changes in the PR have been posted as a comment
  • A brief description of the changes has been added to Changelog.md
  • The latest main has been merged into the PR
  • The config has a new prefix of the format YYYYMMDDdescriptive_title

@lindnemi lindnemi requested a review from toniseibold May 7, 2025 11:27
@lindnemi lindnemi marked this pull request as ready for review May 12, 2025 13:34
Copy link
Contributor

@toniseibold toniseibold left a comment

Choose a reason for hiding this comment

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

Key error

@lindnemi lindnemi requested a review from toniseibold May 14, 2025 07:27
@cpschau cpschau self-requested a review May 14, 2025 15:37
Copy link
Contributor

@cpschau cpschau left a comment

Choose a reason for hiding this comment

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

Tested it in combination with another cascaded SysGF config and scenarios and it worked. Before, I always had to specify a (redundant) source for German CO2 limit as well as some additional industry parameters, which seems to be resolved with this PR. Thank you @lindnemi!

Copy link
Contributor

@toniseibold toniseibold left a comment

Choose a reason for hiding this comment

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

Would be great to see are more extensive explanation in the PR what is happening why (e.g. changing the paths in the Snakefile which otherwise leads to errors since the workflow tries to download the ariadne database mutliple times)
I think this is useful information when new developers look at code in 5 years wondering
I'm not sure if it's necessary to get links dynamically for the national co2 target. Imo this repo does and should not work for other countries

# Adding Efuel imports and exports to constraint
incoming_oil = n.links.index[n.links.index == "EU renewable oil -> DE oil"]
outgoing_oil = n.links.index[n.links.index == "DE renewable oil -> EU oil"]
incoming_oil = n.links.index[n.links.index == f"EU renewable oil -> {ct} oil"]
Copy link
Contributor

Choose a reason for hiding this comment

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

why? a national target for any other country does not make much sense since one would have to change code in modify_prenetwork before it really makes sense
Tested it with e.g. Spain - I would rather see an error/warning that the national target does not account for e.g. oil/methanol/gas.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR:

Changes the syntax of the national_co2_budget configuration to comply with that of other constraints

Only this constraint used to be year:ct:value, now it is ct:year:value just like the others. While changing that I made the code more general for future development (which it already was in some parts, just not consistently). I will add an error to avoid your Spain case

@lindnemi lindnemi merged commit 926239b into main May 15, 2025
7 of 8 checks passed
cpschau pushed a commit that referenced this pull request May 15, 2025
* start by making Mix the default scenario

* make script more robust

* - change syntax of national co2_budget
- define a default national_co2_budget
- allow empty scenario, which falls back to the defaults specified in pypsa.de.yaml

* simplify scenario definitions, fallback to defaults more often

* change prefix

* ariadne_template is data not resources

* fix rounding error

* disable interactive mode in  final plotting script

* decouple ariadne DB pre-workflow from scenario management

* fix key error

* error if co2 budget for country other than DE specified

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* improve wording

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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