File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,19 @@ if config["foresight"] == "perfect":
7878
7979 include : "rules/solve_perfect.smk"
8080
81+ # Pypsa-DE requires the scenario management by default
82+ onstart :
83+ scenarios_file = Path (config ["run" ]["scenarios" ]["file" ])
84+ manual_file = Path (config ["run" ]["scenarios" ]["manual_file" ])
85+
86+ if not scenarios_file .exists ():
87+ print (f"\033 [91mWARNING: { scenarios_file } does not exist. Please run `snakemake build_scenarios` to create it.\033 [0m" )
88+ elif manual_file .exists ():
89+ if scenarios_file .stat ().st_mtime < manual_file .stat ().st_mtime :
90+ print (f"\033 [91mWARNING: { manual_file } is newer than { scenarios_file } . Please run `snakemake build_scenarios` to update { scenarios_file } .\033 [0m" )
91+ else :
92+ print (f"\033 [91mWARNING: { manual_file } does not exist. Please create it to use the scenario management.\033 [0m" )
93+ print (f"Scenario file { scenarios_file } exists and is up to date. Starting workflow." )
8194
8295rule all :
8396 input :
@@ -149,15 +162,6 @@ rule all:
149162 default_target : True
150163
151164
152- rule create_scenarios :
153- output :
154- config ["run" ]["scenarios" ]["file" ],
155- conda :
156- "envs/environment.yaml"
157- script :
158- "config/create_scenarios.py"
159-
160-
161165rule purge :
162166 run :
163167 import builtins
You can’t perform that action at this time.
0 commit comments