From 4b3372b53bb6e9dcdb1759ab5fd171aa9282e729 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 8 Mar 2023 17:46:14 +0100 Subject: [PATCH] apply snakefmt to rules/ --- Snakefile | 1 - rules/collect.smk | 13 +++++++++++-- rules/postprocess.smk | 23 ++++++++++++++++------- rules/retrieve.smk | 6 +----- rules/solve_electricity.smk | 9 ++++++--- rules/solve_myopic.smk | 12 ++++++++---- rules/solve_overnight.smk | 6 ++++-- 7 files changed, 46 insertions(+), 24 deletions(-) diff --git a/Snakefile b/Snakefile index 66c504eb..dfedb1e2 100644 --- a/Snakefile +++ b/Snakefile @@ -58,4 +58,3 @@ if config["foresight"] == "overnight": if config["foresight"] == "myopic": include: "rules/solve_myopic.smk" - diff --git a/rules/collect.smk b/rules/collect.smk index 250fa893..e5713f00 100644 --- a/rules/collect.smk +++ b/rules/collect.smk @@ -2,7 +2,16 @@ # # SPDX-License-Identifier: MIT -localrules: all, cluster_all_networks, extra_components_all_networks, prepare_all_networks, prepare_sector_networks, solve_all_elec_networks, solve_all_networks, plot_all_networks + +localrules: + all, + cluster_all_networks, + extra_components_all_networks, + prepare_all_networks, + prepare_sector_networks, + solve_all_elec_networks, + solve_all_networks, + plot_all_networks, rule all: @@ -63,4 +72,4 @@ rule plot_all_networks: RESULTS + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf", **config["scenario"] - ), \ No newline at end of file + ), diff --git a/rules/postprocess.smk b/rules/postprocess.smk index a322a72e..52647029 100644 --- a/rules/postprocess.smk +++ b/rules/postprocess.smk @@ -2,7 +2,11 @@ # # SPDX-License-Identifier: MIT -localrules: copy_config, copy_conda_env + +localrules: + copy_config, + copy_conda_env, + rule plot_network: input: @@ -23,7 +27,8 @@ rule plot_network: RESULTS + "benchmarks/plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" ) - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: "../scripts/plot_network.py" @@ -38,7 +43,8 @@ rule copy_config: mem_mb=1000, benchmark: RESULTS + "benchmarks/copy_config" - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: "../scripts/copy_config.py" @@ -51,7 +57,8 @@ rule copy_conda_env: mem_mb=500, benchmark: RESULTS + "benchmarks/copy_conda_env" - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" shell: "conda env export -f {output} --no-builds" @@ -95,7 +102,8 @@ rule make_summary: mem_mb=10000, benchmark: RESULTS + "benchmarks/make_summary" - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: "../scripts/make_summary.py" @@ -118,6 +126,7 @@ rule plot_summary: mem_mb=10000, benchmark: RESULTS + "benchmarks/plot_summary" - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: - "../scripts/plot_summary.py" \ No newline at end of file + "../scripts/plot_summary.py" diff --git a/rules/retrieve.smk b/rules/retrieve.smk index cd5ab42f..33c28d5b 100644 --- a/rules/retrieve.smk +++ b/rules/retrieve.smk @@ -3,7 +3,6 @@ # SPDX-License-Identifier: MIT if config["enable"].get("retrieve_databundle", True): - datafiles = [ "ch_cantons.csv", "je-e-21.03.02.xls", @@ -16,7 +15,6 @@ if config["enable"].get("retrieve_databundle", True): "corine/g250_clc06_V18_5.tif", ] - if not config.get("tutorial", False): datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"]) @@ -89,7 +87,6 @@ if config["enable"].get("retrieve_natura_raster", True): if config["enable"].get("retrieve_sector_databundle", True): - datafiles = [ "data/eea/UNFCCC_v23.csv", "data/switzerland-sfoe/switzerland-new_format.csv", @@ -114,7 +111,6 @@ if config["enable"].get("retrieve_sector_databundle", True): if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]: - datafiles = [ "IGGIELGN_LNGs.geojson", "IGGIELGN_BorderPoints.geojson", @@ -156,4 +152,4 @@ rule retrieve_ship_raster: resources: mem_mb=5000, run: - move(input[0], output[0]) \ No newline at end of file + move(input[0], output[0]) diff --git a/rules/solve_electricity.smk b/rules/solve_electricity.smk index 794d45a2..e32cfb8d 100644 --- a/rules/solve_electricity.smk +++ b/rules/solve_electricity.smk @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: MIT + def memory(w): factor = 3.0 for o in w.opts.split("-"): @@ -42,7 +43,8 @@ rule solve_network: mem_mb=memory, shadow: "minimal" - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: "../scripts/solve_network.py" @@ -72,6 +74,7 @@ rule solve_operations_network: mem_mb=(lambda w: 5000 + 372 * int(w.clusters)), shadow: "minimal" - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: - "../scripts/solve_operations_network.py" \ No newline at end of file + "../scripts/solve_operations_network.py" diff --git a/rules/solve_myopic.smk b/rules/solve_myopic.smk index cc3df891..ab4937bc 100644 --- a/rules/solve_myopic.smk +++ b/rules/solve_myopic.smk @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: MIT + rule add_existing_baseyear: input: overrides="data/override_component_attrs", @@ -32,7 +33,8 @@ rule add_existing_baseyear: RESULTS + "benchmarks/add_existing_baseyear/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" ) - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: "../scripts/add_existing_baseyear.py" @@ -69,7 +71,8 @@ rule add_brownfield: RESULTS + "benchmarks/add_brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" ) - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: "../scripts/add_brownfield.py" @@ -104,6 +107,7 @@ rule solve_sector_network_myopic: RESULTS + "benchmarks/solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" ) - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: - "../scripts/solve_sector_network.py" \ No newline at end of file + "../scripts/solve_sector_network.py" diff --git a/rules/solve_overnight.smk b/rules/solve_overnight.smk index 7637e75c..c37e09dd 100644 --- a/rules/solve_overnight.smk +++ b/rules/solve_overnight.smk @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: MIT + rule solve_sector_network: input: overrides="data/override_component_attrs", @@ -30,6 +31,7 @@ rule solve_sector_network: RESULTS + "benchmarks/solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" ) - conda: "../envs/environment.yaml" + conda: + "../envs/environment.yaml" script: - "../scripts/solve_sector_network.py" \ No newline at end of file + "../scripts/solve_sector_network.py"