apply snakefmt to rules/

This commit is contained in:
Fabian Neumann 2023-03-08 17:46:14 +01:00
parent 2d648dac40
commit 4b3372b53b
7 changed files with 46 additions and 24 deletions

View File

@ -58,4 +58,3 @@ if config["foresight"] == "overnight":
if config["foresight"] == "myopic": if config["foresight"] == "myopic":
include: "rules/solve_myopic.smk" include: "rules/solve_myopic.smk"

View File

@ -2,7 +2,16 @@
# #
# SPDX-License-Identifier: MIT # 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: rule all:
@ -63,4 +72,4 @@ rule plot_all_networks:
RESULTS RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf", + "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf",
**config["scenario"] **config["scenario"]
), ),

View File

@ -2,7 +2,11 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
localrules: copy_config, copy_conda_env
localrules:
copy_config,
copy_conda_env,
rule plot_network: rule plot_network:
input: input:
@ -23,7 +27,8 @@ rule plot_network:
RESULTS RESULTS
+ "benchmarks/plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" + "benchmarks/plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
) )
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/plot_network.py" "../scripts/plot_network.py"
@ -38,7 +43,8 @@ rule copy_config:
mem_mb=1000, mem_mb=1000,
benchmark: benchmark:
RESULTS + "benchmarks/copy_config" RESULTS + "benchmarks/copy_config"
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/copy_config.py" "../scripts/copy_config.py"
@ -51,7 +57,8 @@ rule copy_conda_env:
mem_mb=500, mem_mb=500,
benchmark: benchmark:
RESULTS + "benchmarks/copy_conda_env" RESULTS + "benchmarks/copy_conda_env"
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
shell: shell:
"conda env export -f {output} --no-builds" "conda env export -f {output} --no-builds"
@ -95,7 +102,8 @@ rule make_summary:
mem_mb=10000, mem_mb=10000,
benchmark: benchmark:
RESULTS + "benchmarks/make_summary" RESULTS + "benchmarks/make_summary"
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/make_summary.py" "../scripts/make_summary.py"
@ -118,6 +126,7 @@ rule plot_summary:
mem_mb=10000, mem_mb=10000,
benchmark: benchmark:
RESULTS + "benchmarks/plot_summary" RESULTS + "benchmarks/plot_summary"
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/plot_summary.py" "../scripts/plot_summary.py"

View File

@ -3,7 +3,6 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
if config["enable"].get("retrieve_databundle", True): if config["enable"].get("retrieve_databundle", True):
datafiles = [ datafiles = [
"ch_cantons.csv", "ch_cantons.csv",
"je-e-21.03.02.xls", "je-e-21.03.02.xls",
@ -16,7 +15,6 @@ if config["enable"].get("retrieve_databundle", True):
"corine/g250_clc06_V18_5.tif", "corine/g250_clc06_V18_5.tif",
] ]
if not config.get("tutorial", False): if not config.get("tutorial", False):
datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"]) 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): if config["enable"].get("retrieve_sector_databundle", True):
datafiles = [ datafiles = [
"data/eea/UNFCCC_v23.csv", "data/eea/UNFCCC_v23.csv",
"data/switzerland-sfoe/switzerland-new_format.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"]: if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]:
datafiles = [ datafiles = [
"IGGIELGN_LNGs.geojson", "IGGIELGN_LNGs.geojson",
"IGGIELGN_BorderPoints.geojson", "IGGIELGN_BorderPoints.geojson",
@ -156,4 +152,4 @@ rule retrieve_ship_raster:
resources: resources:
mem_mb=5000, mem_mb=5000,
run: run:
move(input[0], output[0]) move(input[0], output[0])

View File

@ -2,6 +2,7 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
def memory(w): def memory(w):
factor = 3.0 factor = 3.0
for o in w.opts.split("-"): for o in w.opts.split("-"):
@ -42,7 +43,8 @@ rule solve_network:
mem_mb=memory, mem_mb=memory,
shadow: shadow:
"minimal" "minimal"
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/solve_network.py" "../scripts/solve_network.py"
@ -72,6 +74,7 @@ rule solve_operations_network:
mem_mb=(lambda w: 5000 + 372 * int(w.clusters)), mem_mb=(lambda w: 5000 + 372 * int(w.clusters)),
shadow: shadow:
"minimal" "minimal"
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/solve_operations_network.py" "../scripts/solve_operations_network.py"

View File

@ -2,6 +2,7 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
rule add_existing_baseyear: rule add_existing_baseyear:
input: input:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
@ -32,7 +33,8 @@ rule add_existing_baseyear:
RESULTS RESULTS
+ "benchmarks/add_existing_baseyear/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" + "benchmarks/add_existing_baseyear/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
) )
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/add_existing_baseyear.py" "../scripts/add_existing_baseyear.py"
@ -69,7 +71,8 @@ rule add_brownfield:
RESULTS RESULTS
+ "benchmarks/add_brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" + "benchmarks/add_brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
) )
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/add_brownfield.py" "../scripts/add_brownfield.py"
@ -104,6 +107,7 @@ rule solve_sector_network_myopic:
RESULTS RESULTS
+ "benchmarks/solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" + "benchmarks/solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
) )
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/solve_sector_network.py" "../scripts/solve_sector_network.py"

View File

@ -2,6 +2,7 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
rule solve_sector_network: rule solve_sector_network:
input: input:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
@ -30,6 +31,7 @@ rule solve_sector_network:
RESULTS RESULTS
+ "benchmarks/solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}" + "benchmarks/solve_sector_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
) )
conda: "../envs/environment.yaml" conda:
"../envs/environment.yaml"
script: script:
"../scripts/solve_sector_network.py" "../scripts/solve_sector_network.py"