-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathloop_run_simulation_woggm.py
More file actions
52 lines (44 loc) · 1.5 KB
/
loop_run_simulation_woggm.py
File metadata and controls
52 lines (44 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Loop through run simulation script
"""
from subprocess import call
gcm_names = ['BCC-CSM2-MR', 'CESM2', 'CESM2-WACCM', 'EC-Earth3', 'EC-Earth3-Veg', 'FGOALS-f3-L',
'GFDL-ESM4', 'INM-CM4-8', 'INM-CM5-0', 'MPI-ESM1-2-HR', 'MRI-ESM2-0', 'NorESM2-MM']
rcps = ['ssp126', 'ssp245', 'ssp370', 'ssp585']
#%% Using input file
for gcm in gcm_names:
for rcp in rcps:
print(gcm, rcp)
# Append arguments to call list
call_list = ["python", "run_simulation.py"]
call_list.append("-gcm_name={}".format(gcm))
call_list.append("-scenario={}".format(rcp))
call_list.append('-option_parallels=0')
# Run script
call(call_list)
#%% Using batches
#region = [15]
#call_list_split = ['python', 'spc_split_glaciers.py', '-n_batches=1', '-option_ordered=0']
#call(call_list_split)
#
#check_str="R" + str(region[0]) + "_rgi_glac_number_batch"
#for i in os.listdir():
# if i.startswith(check_str):
# rgi_pkl_fn = i
#
#for gcm in gcm_names:
# for rcp in rcps:
#
# # Append arguments to call list
# call_list = ["python", "run_simulation_woggm.py"]
# call_list.append("-gcm_name={}".format(gcm))
# call_list.append("-scenario={}".format(rcp))
# call_list.append('-option_parallels=0')
# call_list.append("-rgi_glac_number_fn={}".format(rgi_pkl_fn))
#
## print(call_list)
#
# # Run script
# call(call_list)