From 709b831e06862214c1f7709406dbee91e8007310 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sat, 17 Feb 2024 17:51:26 +0100 Subject: [PATCH] further adjustments where config_provider needs to be called --- Snakefile | 1 - rules/solve_perfect.smk | 2 +- scripts/plot_summary.py | 6 +++--- scripts/prepare_network.py | 6 +++++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Snakefile b/Snakefile index 2c342efc..a59025f9 100644 --- a/Snakefile +++ b/Snakefile @@ -47,7 +47,6 @@ RESULTS = "results/" + RDIR # RESOURCES = "resources/" - localrules: purge, diff --git a/rules/solve_perfect.smk b/rules/solve_perfect.smk index 723fd6a7..3bb006c5 100644 --- a/rules/solve_perfect.smk +++ b/rules/solve_perfect.smk @@ -15,7 +15,7 @@ rule add_existing_baseyear: busmap=resources("busmap_elec_s{simpl}_{clusters}.csv"), clustered_pop_layout=resources("pop_layout_elec_s{simpl}_{clusters}.csv"), costs=resources("costs_{}.csv".format( - config_provider("scenario", "planning_horizons", 0) + config_provider("scenario", "planning_horizons", 0)(w) )), cop_soil_total=resources("cop_soil_total_elec_s{simpl}_{clusters}.nc"), cop_air_total=resources("cop_air_total_elec_s{simpl}_{clusters}.nc"), diff --git a/scripts/plot_summary.py b/scripts/plot_summary.py index f0d80176..4119a811 100644 --- a/scripts/plot_summary.py +++ b/scripts/plot_summary.py @@ -584,8 +584,8 @@ if __name__ == "__main__": plot_balances() + co2_budget = snakemake.params["co2_budget"] if ( - snakemake.params["co2_budget"].startswith("cb") - or snakemake.params["foresight"] == "perfect" - ): + isinstance(co2_budget, str) and co2_budget.startswith("cb") + ) or snakemake.params["foresight"] == "perfect": plot_carbon_budget_distribution(snakemake.input.eurostat) diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index e1b42243..6b782d44 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -62,7 +62,11 @@ import logging import numpy as np import pandas as pd import pypsa -from _helpers import configure_logging, update_config_from_wildcards, set_scenario_config +from _helpers import ( + configure_logging, + set_scenario_config, + update_config_from_wildcards, +) from add_electricity import load_costs, update_transmission_costs from pypsa.descriptors import expand_series