@@ -44,8 +44,8 @@ def remap(self):
44
44
in_rstfiles = glob .glob (rst_dir + '/*' + model + '_*' )
45
45
if len (in_rstfiles ) == 0 :
46
46
return
47
- in_rstfile = in_rstfiles [0 ]
48
-
47
+ in_rstfile = in_rstfiles [0 ]
48
+
49
49
50
50
cwdir = os .getcwd ()
51
51
bindir = os .path .dirname (os .path .realpath (__file__ ))
@@ -60,8 +60,8 @@ def remap(self):
60
60
surflay = config ['output' ]['surface' ]['surflay' ]
61
61
in_tilefile = config ['input' ]['surface' ]['catch_tilefile' ]
62
62
63
- if "gmao_SIteam/ModelData" in out_bc_base :
64
- assert GEOS_SITE == "NAS" , "wrong site to run the package"
63
+ if "gmao_SIteam/ModelData" in out_bc_base :
64
+ assert GEOS_SITE == "NAS" , "wrong site to run the package"
65
65
66
66
if not in_tilefile :
67
67
agrid = config ['input' ]['shared' ]['agrid' ]
@@ -86,7 +86,7 @@ def remap(self):
86
86
87
87
out_bc_landdir = get_landdir (out_bc_base , out_bc_version , agrid = agrid , ogrid = ogrid , omodel = omodel , stretch = stretch , grid = EASE_grid )
88
88
89
- label = get_label (config )
89
+ label = get_label (config )
90
90
91
91
suffix = time + 'z.nc4' + label
92
92
@@ -100,22 +100,22 @@ def remap(self):
100
100
101
101
print ("\n Remapping " + model + ".....\n " )
102
102
# determine NPE based on *approximate* number of input and output tile
103
-
103
+
104
104
in_Ntile = 0
105
105
mime = mimetypes .guess_type (in_rstfile )
106
106
if mime [0 ] and 'stream' in mime [0 ]: # binary
107
107
in_Ntile = 1684725 # if it is binary, it is safe to assume the maximum is M09
108
108
else : # nc4 file
109
109
ds = nc .Dataset (in_rstfile )
110
110
in_Ntile = ds .dimensions ['tile' ].size
111
-
111
+
112
112
out_Ntile = 0
113
113
with open ( out_bc_landdir + '/clsm/catchment.def' ) as f :
114
114
out_Ntile = int (next (f ))
115
115
max_Ntile = max (in_Ntile , out_Ntile )
116
116
NPE = 0
117
117
if (max_Ntile <= 112573 ) : # no more than EASEv2_M36
118
- NPE = 40
118
+ NPE = 40
119
119
elif (max_Ntile <= 1684725 ) : # no more than EASEv2_M09
120
120
NPE = 80
121
121
elif (max_Ntile <= 2496756 ) : # no more than C720
@@ -140,9 +140,7 @@ def remap(self):
140
140
if (partition != '' ):
141
141
PARTITION = "#SBATCH --partition=" + partition
142
142
143
- CONSTRAINT = '"[cas|sky]"'
144
- if BUILT_ON_SLES15 :
145
- CONSTRAINT = 'mil'
143
+ CONSTRAINT = '"[cas|mil]"'
146
144
147
145
account = config ['slurm_pbs' ]['account' ]
148
146
# even if the (MERRA-2) input restarts are binary, the output restarts will always be nc4 (remap_bin2nc.py)
@@ -156,7 +154,7 @@ def remap(self):
156
154
InData_dir = out_dir + '/InData/'
157
155
print ("mkdir -p " + InData_dir )
158
156
os .makedirs (InData_dir , exist_ok = True )
159
-
157
+
160
158
f = os .path .basename (in_rstfile )
161
159
dest = InData_dir + '/' + f
162
160
# file got copy because the computing node cannot access archive
@@ -176,8 +174,8 @@ def remap(self):
176
174
177
175
set params = ( -model {model} -time {time} -in_tilefile {in_tilefile} )
178
176
set params = ( $params -out_bcs {out_bcs} -out_tilefile {out_tilefile} -out_dir {out_dir} )
179
- set params = ( $params -surflay {surflay} -in_wemin {in_wemin} -out_wemin {out_wemin} )
180
- set params = ( $params -in_rst {in_rstfile} -out_rst {out_rstfile} )
177
+ set params = ( $params -surflay {surflay} -in_wemin {in_wemin} -out_wemin {out_wemin} )
178
+ set params = ( $params -in_rst {in_rstfile} -out_rst {out_rstfile} )
181
179
$esma_mpirun_X $mk_catchANDcnRestarts_X $params
182
180
183
181
"""
@@ -256,7 +254,7 @@ def ask_catch_questions():
256
254
catch_input_shared_rst_dir = ''
257
255
def has_rs_rc_out (path ):
258
256
if os .path .exists (path ):
259
- dirs = os .listdir (path )
257
+ dirs = os .listdir (path )
260
258
if 'rs' in dirs and 'rc_out' in dirs :
261
259
nonlocal catch_input_shared_rst_dir
262
260
catch_input_shared_rst_dir = path
@@ -273,7 +271,7 @@ def has_catch_rst(text):
273
271
rst_dir = catch_input_shared_rst_dir + '/rs/ens0000/Y' + yyyy + '/M' + mm + '/'
274
272
rst_files = glob .glob (rst_dir + '*catch*_internal_rst.' + yyyy + mm + dd + '_' + hh + '00' )
275
273
if len (rst_files ) != 1 :
276
- return False
274
+ return False
277
275
return True
278
276
279
277
questions = [
@@ -290,19 +288,19 @@ def has_catch_rst(text):
290
288
"message" : (message_datetime + " and rst file must exist.)\n " ),
291
289
"validate" : lambda text : has_catch_rst (text )
292
290
},
293
-
291
+
294
292
{
295
293
"type" : "path" ,
296
294
"name" : "output:shared:out_dir" ,
297
- "message" : message_out_dir ,
295
+ "message" : message_out_dir ,
298
296
},
299
297
300
298
{
301
299
"type" : "text" ,
302
300
"name" : "output:shared:expid" ,
303
301
"message" : message_expid ,
304
302
"default" : "" ,
305
- },
303
+ },
306
304
307
305
{
308
306
"type" : "select" ,
@@ -319,15 +317,15 @@ def has_catch_rst(text):
319
317
"choices" : choices_bc_ops ,
320
318
"default" : "NL3" ,
321
319
},
322
- {
320
+ {
323
321
"type" : "select" ,
324
322
"name" : "output:shared:bc_version" ,
325
323
"message" : message_bc_other_new ,
326
324
"choices" : choices_bc_other ,
327
325
"when" : lambda x : x ["output:shared:bc_version" ] == 'Other' ,
328
326
},
329
327
330
- {
328
+ {
331
329
"type" : "select" ,
332
330
"name" : "output:surface:EASE_grid" ,
333
331
"message" : "Select grid for new restart:\n " ,
@@ -380,29 +378,29 @@ def has_catch_rst(text):
380
378
"name" : "slurm_pbs:partition" ,
381
379
"message" : message_partition ,
382
380
"default" : '' ,
383
- },
381
+ },
384
382
385
383
]
386
384
387
- answers = questionary .prompt (questions )
385
+ answers = questionary .prompt (questions )
388
386
yyyy = answers ['input:shared:yyyymmddhh' ][0 :4 ]
389
387
mm = answers ['input:shared:yyyymmddhh' ][4 :6 ]
390
388
dd = answers ['input:shared:yyyymmddhh' ][6 :8 ]
391
389
hh = answers ['input:shared:yyyymmddhh' ][8 :10 ]
392
-
390
+
393
391
rst_dir = answers ['input:shared:rst_dir' ]+ '/rs/ens0000/Y' + yyyy + '/M' + mm + '/'
394
392
rst_file = glob .glob (rst_dir + '*catch*_internal_rst.' + yyyy + mm + dd + '_' + hh + '00' )[0 ]
395
393
idx1 = rst_file .find ('catch' )
396
394
idx2 = rst_file .find ('_internal_rst' )
397
395
catch_model = rst_file [idx1 :idx2 ]
398
-
396
+
399
397
tile_dir = answers ['input:shared:rst_dir' ]+ '/rc_out/'
400
398
in_tilefiles = glob .glob (tile_dir + '*.til' )
401
399
for file in in_tilefiles :
402
400
answers ['input:surface:catch_tilefile' ] = file
403
401
if 'MAPL_' in file :
404
402
answers ['input:surface:catch_tilefile' ] = file
405
-
403
+
406
404
answers ['input:shared:rst_dir' ] = rst_dir
407
405
answers ['input:surface:catch_model' ] = catch_model
408
406
answers ['input:surface:wemin' ] = "13"
0 commit comments