Skip to content

Problems with scenario management certain keys are not defined in an overwrite config #2100

@euronion

Description

@euronion

Version Checks (indicate both or one)

  • I have confirmed this bug exists on the lastest release of PyPSA-Eur.

  • I have confirmed this bug exists on the current master branch of PyPSA-Eur.

Issue Description

The scenario management does not work if the config without the scenarios applied does not define scenarios.planning_horizon. This even applies if the scenarios overwrite this value.

If scenarios.planning_horizon is set in the default config, everything seems to work properly and the value is overwritten.

edit: There is another issue (bug or undocumented feature) that I came across. The run:name key needs to be set to run:name="all", else the scenario management is also refusing to run all the scenarios. In the examples below, change the run:name to something else and see for yourself...

Reproducible Example

Use the standard PyPSA-Eur setup with config.default.yaml etc. inside the Snakefile. Then create the following additional configuration files:

# scenarios.yaml
2030:
  scenario:
    planning_horizons:
      - 2030
# working.config.yaml
run:
  prefix: ""
  name: "all"
  scenarios:
    enable: true
    file: scenarios.yaml

scenario:
  planning_horizons:
    - "2050"
# not-working.config.yaml
run:
  prefix: ""
  name: "all"
  scenarios:
    enable: true
    file: scenarios.yaml

scenario:
  planning_horizons:
    - ""

Running snakemake --configfile working.config.yaml -n yields a DAG with networks for planning_horizon=2030.

Running snakemake --configfile not-working.config.yaml -n leads to the following error:

MissingInputException in rule make_global_summary in file "<pypsa-eur>/rules/postprocess.smk", line 254:
Missing input files for rule make_global_summary:
    output: results/csvs/costs.csv, results/csvs/capacities.csv, results/csvs/energy.csv, results/csvs/energy_balance.csv, results/csvs/capacity_factors.csv, results/csvs/metrics.csv, results/csvs/curtailment.csv, results/csvs/prices.csv, results/csvs/weighted_prices.csv, results/csvs/market_values.csv, results/csvs/nodal_costs.csv, results/csvs/nodal_capacities.csv, results/csvs/nodal_energy_balance.csv, results/csvs/nodal_capacity_factors.csv
    affected files:
        results/csvs/individual/nodal_capacity_factors_s_50___.csv
        results/csvs/individual/nodal_energy_balance_s_50___.csv
        results/csvs/individual/costs_s_50___.csv
        results/csvs/individual/energy_balance_s_50___.csv
        results/csvs/individual/weighted_prices_s_50___.csv
        results/csvs/individual/prices_s_50___.csv
        results/csvs/individual/metrics_s_50___.csv
        results/csvs/individual/curtailment_s_50___.csv
        results/csvs/individual/nodal_costs_s_50___.csv
        results/csvs/individual/capacity_factors_s_50___.csv
        results/csvs/individual/nodal_capacities_s_50___.csv
        results/csvs/individual/capacities_s_50___.csv
        results/csvs/individual/market_values_s_50___.csv
        results/csvs/individual/energy_s_50___.csv

Expected Behavior

Allow for planning_horizon to be empty.

Installed Versions

Details Replace this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions