@@ -13,19 +13,15 @@ min_version("8.11")
1313
1414from scripts ._helpers import (
1515 path_provider ,
16- copy_default_files ,
1716 get_scenarios ,
1817 get_rdir ,
1918 get_shadow ,
2019)
2120
2221
23- copy_default_files (workflow )
24-
25-
2622configfile : "config/config.default.yaml"
27- configfile : "config/config .yaml"
28- configfile : "config/config.personal .yaml"
23+ configfile : "config/plotting.default .yaml"
24+ configfile : "config/config.de .yaml"
2925
3026
3127run = config ["run" ]
@@ -53,7 +49,6 @@ localrules:
5349
5450wildcard_constraints :
5551 clusters = "[0-9]+(m|c)?|all|adm" ,
56- ll = r"(v|c)([0-9\.]+|opt)" ,
5752 opts = r"[-+a-zA-Z0-9\.]*" ,
5853 sector_opts = r"[-+a-zA-Z0-9\.\s]*" ,
5954 planning_horizons = r"[0-9]{4}" ,
@@ -66,7 +61,6 @@ include: "rules/build_electricity.smk"
6661include : "rules/build_sector.smk"
6762include : "rules/solve_electricity.smk"
6863include : "rules/postprocess.smk"
69- include : "rules/validate.smk"
7064include : "rules/development.smk"
7165
7266
@@ -88,6 +82,70 @@ if config["foresight"] == "perfect":
8882rule all :
8983 input :
9084 expand (RESULTS + "graphs/costs.svg" , run = config ["run" ]["name" ]),
85+ expand (
86+ resources ("maps/power-network-s-{clusters}.pdf" ),
87+ run = config ["run" ]["name" ],
88+ ** config ["scenario" ],
89+ ),
90+ expand (
91+ RESULTS
92+ + "maps/base_s_{clusters}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf" ,
93+ run = config ["run" ]["name" ],
94+ ** config ["scenario" ],
95+ ),
96+ lambda w : expand (
97+ (
98+ RESULTS
99+ + "maps/base_s_{clusters}_{opts}_{sector_opts}-h2_network_{planning_horizons}.pdf"
100+ if config_provider ("sector" , "H2_network" )(w )
101+ else []
102+ ),
103+ run = config ["run" ]["name" ],
104+ ** config ["scenario" ],
105+ ),
106+ lambda w : expand (
107+ (
108+ RESULTS
109+ + "maps/base_s_{clusters}_{opts}_{sector_opts}-ch4_network_{planning_horizons}.pdf"
110+ if config_provider ("sector" , "gas_network" )(w )
111+ else []
112+ ),
113+ run = config ["run" ]["name" ],
114+ ** config ["scenario" ],
115+ ),
116+ lambda w : expand (
117+ (
118+ RESULTS + "csvs/cumulative_costs.csv"
119+ if config_provider ("foresight" )(w ) == "myopic"
120+ else []
121+ ),
122+ run = config ["run" ]["name" ],
123+ ),
124+ lambda w : expand (
125+ (
126+ RESULTS
127+ + "maps/base_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}-balance_map_{carrier}.pdf"
128+ ),
129+ ** config ["scenario" ],
130+ run = config ["run" ]["name" ],
131+ carrier = config_provider ("plotting" , "balance_map" , "bus_carriers" )(w ),
132+ ),
133+ directory (
134+ expand (
135+ RESULTS
136+ + "graphics/balance_timeseries/s_{clusters}_{opts}_{sector_opts}_{planning_horizons}" ,
137+ run = config ["run" ]["name" ],
138+ ** config ["scenario" ],
139+ ),
140+ ),
141+ directory (
142+ expand (
143+ RESULTS
144+ + "graphics/heatmap_timeseries/s_{clusters}_{opts}_{sector_opts}_{planning_horizons}" ,
145+ run = config ["run" ]["name" ],
146+ ** config ["scenario" ],
147+ ),
148+ ),
91149 default_target : True
92150
93151
@@ -116,13 +174,13 @@ rule purge:
116174 raise Exception (f"Input { do_purge } . Aborting purge." )
117175
118176
119- rule dag :
177+ rule rulegraph :
120178 message :
121- "Creating DAG of workflow."
179+ "Creating RULEGRAPH dag of workflow."
122180 output :
123- dot = resources ("dag .dot" ),
124- pdf = resources ("dag .pdf" ),
125- png = resources ("dag .png" ),
181+ dot = resources ("dag_rulegraph .dot" ),
182+ pdf = resources ("dag_rulegraph .pdf" ),
183+ png = resources ("dag_rulegraph .png" ),
126184 conda :
127185 "envs/environment.yaml"
128186 shell :
@@ -133,6 +191,23 @@ rule dag:
133191 """
134192
135193
194+ rule filegraph :
195+ message :
196+ "Creating FILEGRAPH dag of workflow."
197+ output :
198+ dot = resources ("dag_filegraph.dot" ),
199+ pdf = resources ("dag_filegraph.pdf" ),
200+ png = resources ("dag_filegraph.png" ),
201+ conda :
202+ "envs/environment.yaml"
203+ shell :
204+ r"""
205+ snakemake --filegraph all | sed -n "/digraph/,\$p" > {output.dot}
206+ dot -Tpdf -o {output.pdf} {output.dot}
207+ dot -Tpng -o {output.png} {output.dot}
208+ """
209+
210+
136211rule doc :
137212 message :
138213 "Build documentation."
@@ -359,8 +434,9 @@ rule modify_prenetwork:
359434 regions_offshore = resources ("regions_offshore_base_s_{clusters}.geojson" ),
360435 offshore_connection_points = "ariadne-data/offshore_connection_points.csv" ,
361436 output :
362- network = RESULTS
363- + "networks/base_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}_final.nc" ,
437+ network = resources (
438+ "networks/base_s_{clusters}_{opts}_{sector_opts}_{planning_horizons}_final.nc"
439+ ),
364440 resources :
365441 mem_mb = 4000 ,
366442 log :
@@ -508,6 +584,7 @@ rule export_ariadne_variables:
508584 params :
509585 planning_horizons = config_provider ("scenario" , "planning_horizons" ),
510586 hours = config_provider ("clustering" , "temporal" , "resolution_sector" ),
587+ max_hours = config_provider ("electricity" , "max_hours" ),
511588 costs = config_provider ("costs" ),
512589 config_industry = config_provider ("industry" ),
513590 energy_totals_year = config_provider ("energy" , "energy_totals_year" ),
@@ -680,6 +757,7 @@ rule plot_ariadne_report:
680757 run = config_provider ("run" , "name" ),
681758 foresight = config_provider ("foresight" ),
682759 costs = config_provider ("costs" ),
760+ max_hours = config_provider ("electricity" , "max_hours" ),
683761 post_discretization = config_provider ("solving" , "options" , "post_discretization" ),
684762 NEP_year = config_provider ("costs" , "NEP" ),
685763 hours = config_provider ("clustering" , "temporal" , "resolution_sector" ),
@@ -702,13 +780,13 @@ rule plot_ariadne_report:
702780 ** config ["scenario" ],
703781 allow_missing = True ,
704782 ),
783+ exported_variables_full = RESULTS + "ariadne/exported_variables_full.xlsx" ,
705784 output :
706785 elec_price_duration_curve = RESULTS
707786 + "ariadne/report/elec_price_duration_curve.pdf" ,
708787 elec_price_duration_hist = RESULTS + "ariadne/report/elec_price_duration_hist.pdf" ,
709788 backup_capacity = RESULTS + "ariadne/report/backup_capacity.pdf" ,
710789 backup_generation = RESULTS + "ariadne/report/backup_generation.pdf" ,
711- elec_prices_spatial_de = RESULTS + "ariadne/report/elec_prices_spatial_de.pdf" ,
712790 results = directory (RESULTS + "ariadne/report" ),
713791 elec_transmission = directory (RESULTS + "ariadne/report/elec_transmission" ),
714792 h2_transmission = directory (RESULTS + "ariadne/report/h2_transmission" ),
@@ -717,7 +795,7 @@ rule plot_ariadne_report:
717795 heat_balances = directory (RESULTS + "ariadne/report/heat_balance_timeseries" ),
718796 nodal_balances = directory (RESULTS + "ariadne/report/balance_timeseries_2045" ),
719797 resources :
720- mem_mb = 30000 ,
798+ mem_mb = 32000 ,
721799 log :
722800 RESULTS + "logs/plot_ariadne_report.log" ,
723801 script :
0 commit comments