only copy active configuration to results folder

use copy config for all solve rules
remove copying of environment
This commit is contained in:
Fabian 2023-08-02 14:31:08 +02:00
parent 319c18b0d4
commit 1bf6ea1532
5 changed files with 5 additions and 34 deletions

View File

@ -39,7 +39,7 @@ rule copy_config:
params:
RDIR=RDIR,
output:
RESULTS + "config/config.yaml",
RESULTS + "config.yaml",
threads: 1
resources:
mem_mb=1000,
@ -51,22 +51,6 @@ rule copy_config:
"../scripts/copy_config.py"
rule copy_conda_env:
output:
RESULTS + "config/environment.yaml",
threads: 1
resources:
mem_mb=500,
log:
LOGS + "copy_conda_env.log",
benchmark:
BENCHMARKS + "copy_conda_env"
conda:
"../envs/environment.yaml"
shell:
"conda env export -f {output} --no-builds"
rule make_summary:
params:
foresight=config["foresight"],

View File

@ -13,6 +13,7 @@ rule solve_network:
),
input:
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
config=RESULTS + "config.yaml",
output:
network=RESULTS + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
log:

View File

@ -92,7 +92,7 @@ rule solve_sector_network_myopic:
network=RESULTS
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
costs="data/costs_{planning_horizons}.csv",
config=RESULTS + "config/config.yaml",
config=RESULTS + "config.yaml",
output:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",

View File

@ -14,9 +14,7 @@ rule solve_sector_network:
input:
network=RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
costs="data/costs_{}.csv".format(config["costs"]["year"]),
config=RESULTS + "config/config.yaml",
#env=RDIR + 'config/environment.yaml',
config=RESULTS + "config.yaml",
output:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",

View File

@ -11,25 +11,13 @@ from shutil import copy
import yaml
files = {
"config/config.yaml": "config.yaml",
"Snakefile": "Snakefile",
"scripts/solve_network.py": "solve_network.py",
"scripts/prepare_sector_network.py": "prepare_sector_network.py",
}
if __name__ == "__main__":
if "snakemake" not in globals():
from _helpers import mock_snakemake
snakemake = mock_snakemake("copy_config")
basepath = Path(f"results/{snakemake.params.RDIR}config/")
for f, name in files.items():
copy(f, basepath / name)
with open(basepath / "config.snakemake.yaml", "w") as yaml_file:
with open(snakemake.output[0], "w") as yaml_file:
yaml.dump(
snakemake.config,
yaml_file,