Skip to content

Commit 1876111

Browse files
committed
Add MODEL_list variable for global_det atmos prep
Refs: NOAA-EMC#1
1 parent 3ec844e commit 1876111

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

ecf/global_det/prep/jevs_global_det_atmos_prep.ecf

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ export STEP=prep
8484
export COMPONENT=global_det
8585
export RUN=atmos
8686

87+
export MODEL_list="cfs cmc cmc_regional dwd ecmwf fnmoc gfs imd jma metfra ukmet"
88+
8789
# CALL executable job script here
8890
$HOMEevs/jobs/global_det/prep/JEVS_GLOBAL_DET_PREP
8991

scripts/global_det/prep/exevs_global_det_atmos_prep.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ echo
1414
## Global Deterministic Atmospheric Prep
1515
############################################################
1616
python ${USHevs}/global_det/global_det_atmos_prep_prod_archive.py
17+
status=$?
18+
[[ $status -ne 0 ]] && exit $status
19+
[[ $status -eq 0 ]] && echo "Succesfully ran ${USHevs}/global_det/global_det_atmos_prep_prod_archive.py"
1720

1821
if [ $SENDCOM = YES ]; then
19-
for MODEL in cfs cmc cmc_regional dwd ecmwf fnmoc gfs imd jma metfra ukmet; do
22+
for MODEL in $MODEL_LIST; do
2023
mkdir -p $COMOUT/$MODEL
2124
for FILE in $DATA/$RUN.$INITDATE/$MODEL/*; do
2225
cp -v $FILE $COMOUT/$MODEL/.

ush/global_det/global_det_atmos_prep_prod_archive.py

+28-23
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import glob
1010
import shutil
1111
import global_det_atmos_util as gda_util
12+
import sys
1213

1314
print("BEGIN: "+os.path.basename(__file__))
1415

@@ -25,6 +26,7 @@
2526
RUN = os.environ['RUN']
2627
COMPONENT = os.environ['COMPONENT']
2728
STEP = os.environ['STEP']
29+
MODEL_list = os.environ['MODEL_list'].split(' ')
2830
gfs_ver = os.environ['gfs_ver']
2931
cmc_ver = os.environ['cmc_ver']
3032
cfs_ver = os.environ['cfs_ver']
@@ -207,9 +209,12 @@
207209
+'t{init?fmt=%2H}z.'
208210
+'f{lead?fmt=%3H}')
209211

210-
for model in list(global_det_model_dict.keys()):
211-
print("---- Prepping data for "+model+" for init "+INITDATE)
212-
model_dict = global_det_model_dict[model]
212+
for MODEL in MODEL_list:
213+
if MODEL not in list(global_det_model_dict.keys()):
214+
print("ERROR: "+MODEL+" not recongized")
215+
sys.exit(1)
216+
print("---- Prepping data for "+MODEL+" for init "+INITDATE)
217+
model_dict = global_det_model_dict[MODEL]
213218
for cycle in model_dict['cycles']:
214219
CDATE = INITDATE+cycle
215220
CDATE_dt = datetime.datetime.strptime(CDATE, '%Y%m%d%H')
@@ -223,34 +228,34 @@
223228
)
224229
arch_fcst_file = gda_util.format_filler(
225230
arch_fcst_file_format, VDATE_dt, CDATE_dt,
226-
str(fcst_hr), {'model': model}
231+
str(fcst_hr), {'model': MODEL}
227232
)
228233
if not os.path.exists(arch_fcst_file):
229234
print("----> Trying to create "+arch_fcst_file)
230235
arch_fcst_file_dir = arch_fcst_file.rpartition('/')[0]
231236
if not os.path.exists(arch_fcst_file_dir):
232237
os.makedirs(arch_fcst_file_dir)
233-
if model in ['ecmwf']:
238+
if MODEL in ['ecmwf']:
234239
gda_util.run_shell_command(['chmod', '750',
235240
arch_fcst_file_dir])
236241
gda_util.run_shell_command(['chgrp', 'rstprod',
237242
arch_fcst_file_dir])
238-
if model == 'gfs':
243+
if MODEL == 'gfs':
239244
gda_util.prep_prod_gfs_file(prod_fcst_file,
240245
arch_fcst_file,
241246
str(fcst_hr),
242247
'full')
243-
elif model == 'jma':
248+
elif MODEL == 'jma':
244249
gda_util.prep_prod_jma_file(prod_fcst_file,
245250
arch_fcst_file,
246251
str(fcst_hr),
247252
'full')
248-
elif model == 'ecmwf':
253+
elif MODEL == 'ecmwf':
249254
gda_util.prep_prod_ecmwf_file(prod_fcst_file,
250255
arch_fcst_file,
251256
str(fcst_hr),
252257
'full')
253-
elif model == 'ukmet':
258+
elif MODEL == 'ukmet':
254259
gda_util.prep_prod_ukmet_file(prod_fcst_file,
255260
arch_fcst_file,
256261
str(fcst_hr),
@@ -264,7 +269,7 @@
264269
)
265270
arch_precip_file = gda_util.format_filler(
266271
arch_precip_file_format, VDATE_dt,
267-
CDATE_dt, str(fcst_hr), {'model': model}
272+
CDATE_dt, str(fcst_hr), {'model': MODEL}
268273
)
269274
if not os.path.exists(arch_precip_file) and fcst_hr != 0:
270275
print("----> Trying to create "+arch_precip_file)
@@ -273,40 +278,40 @@
273278
)
274279
if not os.path.exists(arch_precip_file_dir):
275280
os.makedirs(arch_precip_file_dir)
276-
if model in ['ecmwf']:
281+
if MODEL in ['ecmwf']:
277282
gda_util.run_shell_command(
278283
['chmod', '750', arch_precip_file_dir]
279284
)
280285
gda_util.run_shell_command(
281286
['chgrp', 'rstprod',
282287
arch_precip_file_dir]
283288
)
284-
if model == 'gfs':
289+
if MODEL == 'gfs':
285290
gda_util.prep_prod_gfs_file(prod_precip_file,
286291
arch_precip_file,
287292
str(fcst_hr),
288293
'precip')
289-
elif model == 'jma':
294+
elif MODEL == 'jma':
290295
gda_util.prep_prod_jma_file(prod_precip_file,
291296
arch_precip_file,
292297
str(fcst_hr),
293298
'precip')
294-
elif model == 'ecmwf':
299+
elif MODEL == 'ecmwf':
295300
gda_util.prep_prod_ecmwf_file(prod_precip_file,
296301
arch_precip_file,
297302
str(fcst_hr),
298303
'precip')
299-
elif model == 'ukmet':
304+
elif MODEL == 'ukmet':
300305
gda_util.prep_prod_ukmet_file(prod_precip_file,
301306
arch_precip_file,
302307
str(fcst_hr),
303308
'precip')
304-
elif model == 'dwd':
309+
elif MODEL == 'dwd':
305310
gda_util.prep_prod_dwd_file(prod_precip_file,
306311
arch_precip_file,
307312
str(fcst_hr),
308313
'precip')
309-
elif model == 'metfra':
314+
elif MODEL == 'metfra':
310315
gda_util.prep_prod_metfra_file(prod_precip_file,
311316
arch_precip_file,
312317
str(fcst_hr),
@@ -322,34 +327,34 @@
322327
)
323328
arch_anl_file = gda_util.format_filler(
324329
arch_anl_file_format, CDATE_dt, CDATE_dt,
325-
'anl', {'model': model}
330+
'anl', {'model': MODEL}
326331
)
327332
if not os.path.exists(arch_anl_file):
328333
arch_anl_file_dir = arch_anl_file.rpartition('/')[0]
329334
if not os.path.exists(arch_anl_file_dir):
330335
os.makedirs(arch_anl_file_dir)
331-
if model in ['ecmwf']:
336+
if MODEL in ['ecmwf']:
332337
gda_util.run_shell_command(['chmod', '750',
333338
arch_anl_file_dir])
334339
gda_util.run_shell_command(['chgrp', 'rstprod',
335340
arch_anl_file_dir])
336341
print("----> Trying to create "+arch_anl_file)
337-
if model == 'gfs':
342+
if MODEL == 'gfs':
338343
gda_util.prep_prod_gfs_file(prod_anl_file,
339344
arch_anl_file,
340345
'anl',
341346
'full')
342-
elif model == 'jma':
347+
elif MODEL == 'jma':
343348
gda_util.prep_prod_jma_file(prod_anl_file,
344349
arch_anl_file,
345350
'anl',
346351
'full')
347-
elif model == 'ecmwf':
352+
elif MODEL == 'ecmwf':
348353
gda_util.prep_prod_ecmwf_file(prod_anl_file,
349354
arch_anl_file,
350355
'anl',
351356
'full')
352-
elif model == 'ukmet':
357+
elif MODEL == 'ukmet':
353358
gda_util.prep_prod_ukmet_file(prod_anl_file,
354359
arch_anl_file,
355360
'anl',

0 commit comments

Comments
 (0)