add results dir to simplify multiple configs (like PyPSA-Eur-Sec)
This commit is contained in:
parent
630fb9783f
commit
64424ed208
70
Snakefile
70
Snakefile
@ -15,7 +15,7 @@ configfile: "config.yaml"
|
|||||||
|
|
||||||
COSTS="data/costs.csv"
|
COSTS="data/costs.csv"
|
||||||
ATLITE_NPROCESSES = config['atlite'].get('nprocesses', 4)
|
ATLITE_NPROCESSES = config['atlite'].get('nprocesses', 4)
|
||||||
|
RDIR = config["results_dir"]
|
||||||
|
|
||||||
wildcard_constraints:
|
wildcard_constraints:
|
||||||
simpl="[a-zA-Z0-9]*|all",
|
simpl="[a-zA-Z0-9]*|all",
|
||||||
@ -25,19 +25,19 @@ wildcard_constraints:
|
|||||||
|
|
||||||
|
|
||||||
rule cluster_all_networks:
|
rule cluster_all_networks:
|
||||||
input: expand("networks/elec_s{simpl}_{clusters}.nc", **config['scenario'])
|
input: expand(RDIR + "networks/elec_s{simpl}_{clusters}.nc", **config['scenario'])
|
||||||
|
|
||||||
|
|
||||||
rule extra_components_all_networks:
|
rule extra_components_all_networks:
|
||||||
input: expand("networks/elec_s{simpl}_{clusters}_ec.nc", **config['scenario'])
|
input: expand(RDIR + "networks/elec_s{simpl}_{clusters}_ec.nc", **config['scenario'])
|
||||||
|
|
||||||
|
|
||||||
rule prepare_all_networks:
|
rule prepare_all_networks:
|
||||||
input: expand("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", **config['scenario'])
|
input: expand(RDIR + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", **config['scenario'])
|
||||||
|
|
||||||
|
|
||||||
rule solve_all_networks:
|
rule solve_all_networks:
|
||||||
input: expand("results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", **config['scenario'])
|
input: expand(RDIR + "results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", **config['scenario'])
|
||||||
|
|
||||||
|
|
||||||
if config['enable'].get('prepare_links_p_nom', False):
|
if config['enable'].get('prepare_links_p_nom', False):
|
||||||
@ -228,7 +228,7 @@ rule add_electricity:
|
|||||||
nuts3_shapes='resources/nuts3_shapes.geojson',
|
nuts3_shapes='resources/nuts3_shapes.geojson',
|
||||||
**{f"profile_{tech}": f"resources/profile_{tech}.nc"
|
**{f"profile_{tech}": f"resources/profile_{tech}.nc"
|
||||||
for tech in config['renewable']}
|
for tech in config['renewable']}
|
||||||
output: "networks/elec.nc"
|
output: RDIR + "/prenetworks/elec.nc"
|
||||||
log: "logs/add_electricity.log"
|
log: "logs/add_electricity.log"
|
||||||
benchmark: "benchmarks/add_electricity"
|
benchmark: "benchmarks/add_electricity"
|
||||||
threads: 1
|
threads: 1
|
||||||
@ -238,16 +238,16 @@ rule add_electricity:
|
|||||||
|
|
||||||
rule simplify_network:
|
rule simplify_network:
|
||||||
input:
|
input:
|
||||||
network='networks/elec.nc',
|
network=RDIR + '/prenetworks/elec.nc',
|
||||||
tech_costs=COSTS,
|
tech_costs=COSTS,
|
||||||
regions_onshore="resources/regions_onshore.geojson",
|
regions_onshore="/resources/regions_onshore.geojson",
|
||||||
regions_offshore="resources/regions_offshore.geojson"
|
regions_offshore="/resources/regions_offshore.geojson"
|
||||||
output:
|
output:
|
||||||
network='networks/elec_s{simpl}.nc',
|
network=RDIR + '/prenetworks/elec_s{simpl}.nc',
|
||||||
regions_onshore="resources/regions_onshore_elec_s{simpl}.geojson",
|
regions_onshore=RDIR + "/resources/regions_onshore_elec_s{simpl}.geojson",
|
||||||
regions_offshore="resources/regions_offshore_elec_s{simpl}.geojson",
|
regions_offshore=RDIR + "/resources/regions_offshore_elec_s{simpl}.geojson",
|
||||||
busmap='resources/busmap_elec_s{simpl}.csv',
|
busmap=RDIR + '/resources/busmap_elec_s{simpl}.csv',
|
||||||
connection_costs='resources/connection_costs_s{simpl}.csv'
|
connection_costs=RDIR + '/resources/connection_costs_s{simpl}.csv'
|
||||||
log: "logs/simplify_network/elec_s{simpl}.log"
|
log: "logs/simplify_network/elec_s{simpl}.log"
|
||||||
benchmark: "benchmarks/simplify_network/elec_s{simpl}"
|
benchmark: "benchmarks/simplify_network/elec_s{simpl}"
|
||||||
threads: 1
|
threads: 1
|
||||||
@ -257,19 +257,19 @@ rule simplify_network:
|
|||||||
|
|
||||||
rule cluster_network:
|
rule cluster_network:
|
||||||
input:
|
input:
|
||||||
network='networks/elec_s{simpl}.nc',
|
network=RDIR + '/prenetworks/elec_s{simpl}.nc',
|
||||||
regions_onshore="resources/regions_onshore_elec_s{simpl}.geojson",
|
regions_onshore=RDIR + "/resources/regions_onshore_elec_s{simpl}.geojson",
|
||||||
regions_offshore="resources/regions_offshore_elec_s{simpl}.geojson",
|
regions_offshore=RDIR + "/resources/regions_offshore_elec_s{simpl}.geojson",
|
||||||
busmap=ancient('resources/busmap_elec_s{simpl}.csv'),
|
busmap=ancient(RDIR + '/resources/busmap_elec_s{simpl}.csv'),
|
||||||
custom_busmap=("data/custom_busmap_elec_s{simpl}_{clusters}.csv"
|
custom_busmap=("data/custom_busmap_elec_s{simpl}_{clusters}.csv"
|
||||||
if config["enable"].get("custom_busmap", False) else []),
|
if config["enable"].get("custom_busmap", False) else []),
|
||||||
tech_costs=COSTS
|
tech_costs=COSTS
|
||||||
output:
|
output:
|
||||||
network='networks/elec_s{simpl}_{clusters}.nc',
|
network=RDIR + '/prenetworks/elec_s{simpl}_{clusters}.nc',
|
||||||
regions_onshore="resources/regions_onshore_elec_s{simpl}_{clusters}.geojson",
|
regions_onshore=RDIR + "/resources/regions_onshore_elec_s{simpl}_{clusters}.geojson",
|
||||||
regions_offshore="resources/regions_offshore_elec_s{simpl}_{clusters}.geojson",
|
regions_offshore=RDIR + "/resources/regions_offshore_elec_s{simpl}_{clusters}.geojson",
|
||||||
busmap="resources/busmap_elec_s{simpl}_{clusters}.csv",
|
busmap=RDIR + "/resources/busmap_elec_s{simpl}_{clusters}.csv",
|
||||||
linemap="resources/linemap_elec_s{simpl}_{clusters}.csv"
|
linemap=RDIR + "/resources/linemap_elec_s{simpl}_{clusters}.csv"
|
||||||
log: "logs/cluster_network/elec_s{simpl}_{clusters}.log"
|
log: "logs/cluster_network/elec_s{simpl}_{clusters}.log"
|
||||||
benchmark: "benchmarks/cluster_network/elec_s{simpl}_{clusters}"
|
benchmark: "benchmarks/cluster_network/elec_s{simpl}_{clusters}"
|
||||||
threads: 1
|
threads: 1
|
||||||
@ -279,9 +279,9 @@ rule cluster_network:
|
|||||||
|
|
||||||
rule add_extra_components:
|
rule add_extra_components:
|
||||||
input:
|
input:
|
||||||
network='networks/elec_s{simpl}_{clusters}.nc',
|
network=RDIR + '/prenetworks/elec_s{simpl}_{clusters}.nc',
|
||||||
tech_costs=COSTS,
|
tech_costs=COSTS,
|
||||||
output: 'networks/elec_s{simpl}_{clusters}_ec.nc'
|
output: RDIR + '/prenetworks/elec_s{simpl}_{clusters}_ec.nc'
|
||||||
log: "logs/add_extra_components/elec_s{simpl}_{clusters}.log"
|
log: "logs/add_extra_components/elec_s{simpl}_{clusters}.log"
|
||||||
benchmark: "benchmarks/add_extra_components/elec_s{simpl}_{clusters}_ec"
|
benchmark: "benchmarks/add_extra_components/elec_s{simpl}_{clusters}_ec"
|
||||||
threads: 1
|
threads: 1
|
||||||
@ -290,8 +290,8 @@ rule add_extra_components:
|
|||||||
|
|
||||||
|
|
||||||
rule prepare_network:
|
rule prepare_network:
|
||||||
input: 'networks/elec_s{simpl}_{clusters}_ec.nc', tech_costs=COSTS
|
input: RDIR + '/prenetworks/elec_s{simpl}_{clusters}_ec.nc', tech_costs=COSTS
|
||||||
output: 'networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc'
|
output: RDIR + '/prenetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc'
|
||||||
log: "logs/prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"
|
log: "logs/prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"
|
||||||
benchmark: "benchmarks/prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
benchmark: "benchmarks/prepare_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}"
|
||||||
threads: 1
|
threads: 1
|
||||||
@ -320,8 +320,8 @@ def memory(w):
|
|||||||
|
|
||||||
|
|
||||||
rule solve_network:
|
rule solve_network:
|
||||||
input: "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
input: RDIR + "/prenetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
||||||
output: "results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
output: RDIR + "/postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
||||||
log:
|
log:
|
||||||
solver=normpath("logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_solver.log"),
|
solver=normpath("logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_solver.log"),
|
||||||
python="logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log",
|
python="logs/solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log",
|
||||||
@ -335,9 +335,9 @@ rule solve_network:
|
|||||||
|
|
||||||
rule solve_operations_network:
|
rule solve_operations_network:
|
||||||
input:
|
input:
|
||||||
unprepared="networks/elec_s{simpl}_{clusters}_ec.nc",
|
unprepared=RDIR + "/prenetworks/elec_s{simpl}_{clusters}_ec.nc",
|
||||||
optimized="results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
optimized=RDIR + "/postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"
|
||||||
output: "results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc"
|
output: RDIR + "postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op.nc"
|
||||||
log:
|
log:
|
||||||
solver=normpath("logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_solver.log"),
|
solver=normpath("logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_solver.log"),
|
||||||
python="logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_python.log",
|
python="logs/solve_operations_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_op_python.log",
|
||||||
@ -351,7 +351,7 @@ rule solve_operations_network:
|
|||||||
|
|
||||||
rule plot_network:
|
rule plot_network:
|
||||||
input:
|
input:
|
||||||
network="results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
network=RDIR + "/postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
||||||
tech_costs=COSTS
|
tech_costs=COSTS
|
||||||
output:
|
output:
|
||||||
only_map="results/plots/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}.{ext}",
|
only_map="results/plots/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{attr}.{ext}",
|
||||||
@ -369,7 +369,7 @@ def input_make_summary(w):
|
|||||||
else:
|
else:
|
||||||
ll = w.ll
|
ll = w.ll
|
||||||
return ([COSTS] +
|
return ([COSTS] +
|
||||||
expand("results/networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
expand(RDIR + "/postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
|
||||||
ll=ll,
|
ll=ll,
|
||||||
**{k: config["scenario"][k] if getattr(w, k) == "all" else getattr(w, k)
|
**{k: config["scenario"][k] if getattr(w, k) == "all" else getattr(w, k)
|
||||||
for k in ["simpl", "clusters", "opts"]}))
|
for k in ["simpl", "clusters", "opts"]}))
|
||||||
@ -390,7 +390,7 @@ rule plot_summary:
|
|||||||
|
|
||||||
|
|
||||||
def input_plot_p_nom_max(w):
|
def input_plot_p_nom_max(w):
|
||||||
return [("networks/elec_s{simpl}{maybe_cluster}.nc"
|
return [(RDIR + "/postnetworks/elec_s{simpl}{maybe_cluster}.nc"
|
||||||
.format(maybe_cluster=('' if c == 'full' else ('_' + c)), **w))
|
.format(maybe_cluster=('' if c == 'full' else ('_' + c)), **w))
|
||||||
for c in w.clusts.split(",")]
|
for c in w.clusts.split(",")]
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ logging:
|
|||||||
level: INFO
|
level: INFO
|
||||||
format: '%(levelname)s:%(name)s:%(message)s'
|
format: '%(levelname)s:%(name)s:%(message)s'
|
||||||
|
|
||||||
summary_dir: results
|
results_dir: results/your-run-name
|
||||||
|
|
||||||
scenario:
|
scenario:
|
||||||
simpl: ['']
|
simpl: ['']
|
||||||
|
Loading…
Reference in New Issue
Block a user