Skip to content

Commit a18efae

Browse files
authored
Reorder post so all flux files are generated when running offline (#1181)
Post would fail when running without inline post because it would attempt to create 1p00 flux files before the flux file had been generated. `inter_flux.sh` also had to be updated to point at the correct file for offline post, which is now the same as inline. Fixes #1157
1 parent 5b454c3 commit a18efae

File tree

2 files changed

+45
-54
lines changed

2 files changed

+45
-54
lines changed

scripts/exgfs_atmos_post.sh

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export TCYC=${TCYC:-".t${cyc}z."}
6969
export OUTPUT_FILE=${OUTPUT_FILE:-"nemsio"}
7070
export PREFIX=${PREFIX:-${RUN}${TCYC}}
7171
if (( OUTTYP == 4 )); then
72-
if [ "${OUTPUT_FILE}" = "netcdf" ]; then
72+
if [[ "${OUTPUT_FILE}" = "netcdf" ]]; then
7373
export SUFFIX=".nc"
7474
else
7575
export SUFFIX=".nemsio"
@@ -101,8 +101,8 @@ else
101101
export loganl="${COMIN}/${PREFIX}sanl"
102102
fi
103103

104-
if [ "${stime}" = "anl" ]; then
105-
if [ -f "${loganl}" ]; then
104+
if [[ "${stime}" = "anl" ]]; then
105+
if [[ -f "${loganl}" ]]; then
106106
# add new environmental variables for running new ncep post
107107
# Validation date
108108
export VDATE=${PDY}${cyc}
@@ -113,7 +113,7 @@ if [ "${stime}" = "anl" ]; then
113113

114114
# specify smaller control file for GDAS because GDAS does not
115115
# produce flux file, the default will be /nwprod/parm/gfs_cntrl.parm
116-
if [ "${GRIBVERSION}" = 'grib2' ]; then
116+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
117117
# use grib2 nomonic table in product g2tmpl directory as default
118118
export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new}
119119
export PostFlatFile=${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS-ANL.txt}
@@ -138,31 +138,31 @@ if [ "${stime}" = "anl" ]; then
138138
${POSTGPSH}
139139
export err=$?; err_chk
140140

141-
if [ "${GRIBVERSION}" = 'grib2' ]; then
141+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
142142
mv "${PGBOUT}" "${PGBOUT2}"
143143
fi
144144

145145
# Process pgb files
146-
if [ "${PGBF}" = 'YES' ]; then
146+
if [[ "${PGBF}" = 'YES' ]]; then
147147
export FH=-1
148148
export downset=${downset:-2}
149149
${GFSDOWNSH}
150150
export err=$?; err_chk
151151
fi
152152

153-
if [ "${SENDCOM}" = 'YES' ]; then
153+
if [[ "${SENDCOM}" = 'YES' ]]; then
154154
export fhr3=anl
155-
if [ "${GRIBVERSION}" = 'grib2' ]; then
155+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
156156
MASTERANL=${PREFIX}master.grb2${fhr3}
157157
MASTERANLIDX=${PREFIX}master.grb2i${fhr3}
158158
cp "${PGBOUT2}" "${COMOUT}/${MASTERANL}"
159159
${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}"
160160
fi
161161

162-
if [ "${SENDDBN}" = 'YES' ]; then
162+
if [[ "${SENDDBN}" = 'YES' ]]; then
163163
"${DBNROOT}/bin/dbn_alert" MODEL GFS_MSC_sfcanl "${job}" "${COMOUT}/${PREFIX}sfcanl${SUFFIX}"
164164
"${DBNROOT}/bin/dbn_alert" MODEL GFS_SA "${job}" "${COMOUT}/${PREFIX}atmanl${SUFFIX}"
165-
if [ "${PGBF}" = 'YES' ]; then
165+
if [[ "${PGBF}" = 'YES' ]]; then
166166
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl"
167167
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl.idx"
168168
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.anl"
@@ -185,7 +185,7 @@ if [ "${stime}" = "anl" ]; then
185185

186186
########################## WAFS U/V/T analysis start ##########################
187187
# U/V/T on ICAO standard atmospheric pressure levels for WAFS verification
188-
if [ "${WAFSF}" = "YES" ]; then
188+
if [[ "${WAFSF}" = "YES" ]]; then
189189
if [[ "${RUN}" = "gfs" && "${GRIBVERSION}" = 'grib2' ]]; then
190190
export OUTTYP=${OUTTYP:-4}
191191

@@ -208,7 +208,7 @@ if [ "${stime}" = "anl" ]; then
208208
-new_grid_interpolation bilinear -set_bitmap 1 \
209209
-new_grid ${wafsgrid} "${PGBOUT}.tmp"
210210

211-
if [ "${SENDCOM}" = "YES" ]; then
211+
if [[ "${SENDCOM}" = "YES" ]]; then
212212
cp "${PGBOUT}.tmp" "${COMOUT}/${PREFIX}wafs.0p25.anl"
213213
${WGRIB2} -s "${PGBOUT}.tmp" > "${COMOUT}/${PREFIX}wafs.0p25.anl.idx"
214214

@@ -244,7 +244,7 @@ else ## not_anl if_stime
244244
export pgm="postcheck"
245245
ic=1
246246
while (( ic <= SLEEP_LOOP_MAX )); do
247-
if [ -f "${restart_file}${fhr}.txt" ]; then
247+
if [[ -f "${restart_file}${fhr}.txt" ]]; then
248248
break
249249
else
250250
ic=$(( ic + 1 ))
@@ -288,11 +288,11 @@ else ## not_anl if_stime
288288
export OUTTYP=${OUTTYP:-4}
289289
export GFSOUT="${PREFIX}gfsio${fhr}"
290290

291-
if [ "${GRIBVERSION}" = 'grib2' ]; then
291+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
292292
export POSTGRB2TBL="${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new}"
293293
export PostFlatFile="${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS.txt}"
294294

295-
if [ "${RUN}" = "gfs" ]; then
295+
if [[ "${RUN}" = "gfs" ]]; then
296296
export IGEN=${IGEN_GFS}
297297
if (( fhr > 0 )); then export IGEN=${IGEN_FCST} ; fi
298298
else
@@ -322,54 +322,54 @@ else ## not_anl if_stime
322322
export PGBOUT2=pgbfile.grib2
323323
export PGIOUT2=pgifile.grib2.idx
324324
export FILTER=0
325-
if [ "${GRIBVERSION}" = 'grib2' ]; then
325+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
326326
MASTERFL=${PREFIX}master.grb2f${fhr}
327327
MASTERFLIDX=${PREFIX}master.grb2if${fhr}
328328
fi
329329

330-
if [ "${INLINE_POST}" = ".false." ]; then
330+
if [[ "${INLINE_POST}" = ".false." ]]; then
331331
${POSTGPSH}
332332
else
333333
cp -p "${COMOUT}/${MASTERFL}" "${PGBOUT}"
334334
fi
335335
export err=$?; err_chk
336336

337-
if [ "${GRIBVERSION}" = 'grib2' ]; then
337+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
338338
mv "${PGBOUT}" "${PGBOUT2}"
339339
fi
340340

341341
# Process pgb files
342-
if [ "${PGBF}" = 'YES' ]; then
342+
if [[ "${PGBF}" = 'YES' ]]; then
343343
export FH=$(( 10#${fhr} + 0 ))
344344
export downset=${downset:-2}
345345
${GFSDOWNSH}
346346
export err=$?; err_chk
347347
fi
348348

349-
if [ "${SENDCOM}" = "YES" ]; then
350-
if [ "${GRIBVERSION}" = 'grib2' ]; then
351-
if [ "${INLINE_POST}" = ".false." ]; then
349+
if [[ "${SENDCOM}" = "YES" ]]; then
350+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
351+
if [[ "${INLINE_POST}" = ".false." ]]; then
352352
cp "${PGBOUT2}" "${COMOUT}/${MASTERFL}"
353353
fi
354354
${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERFLIDX}"
355355
fi
356356

357-
if [ "${SENDDBN}" = 'YES' ]; then
358-
if [ "${GRIBVERSION}" = 'grib2' ]; then
359-
if [ "${PGBF}" = 'YES' ]; then
357+
if [[ "${SENDDBN}" = 'YES' ]]; then
358+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
359+
if [[ "${PGBF}" = 'YES' ]]; then
360360
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}"
361361
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx"
362362
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.f${fhr}"
363363
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.f${fhr}.idx"
364364

365-
if [ -s "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}" ]; then
365+
if [[ -s "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}" ]]; then
366366
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}"
367367
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}.idx"
368368
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.f${fhr}"
369369
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.f${fhr}.idx"
370370
fi
371371

372-
if [ -s "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" ]; then
372+
if [[ -s "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" ]]; then
373373
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}"
374374
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}.idx"
375375
"${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.f${fhr}"
@@ -400,29 +400,29 @@ else ## not_anl if_stime
400400
export FLUXFL=${PREFIX}sfluxgrbf${fhr}.grib2
401401
FLUXFLIDX=${PREFIX}sfluxgrbf${fhr}.grib2.idx
402402

403-
#Add extra flux.1p00 file for coupled
404-
if [ "${FLXGF}" = 'YES' ]; then
405-
export FH=$(( 10#${fhr} + 0 ))
406-
${GFSDOWNSHF}
407-
export err=$?; err_chk
408-
fi
409-
410-
if [ "${INLINE_POST}" = ".false." ]; then
403+
if [[ "${INLINE_POST}" = ".false." ]]; then
411404
${POSTGPSH}
412405
export err=$?; err_chk
413406
mv fluxfile "${COMOUT}/${FLUXFL}"
414407
fi
415408
${WGRIB2} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}"
416409

417-
if [ "${SENDDBN}" = 'YES' ]; then
410+
#Add extra flux.1p00 file for coupled
411+
if [[ "${FLXGF}" = 'YES' ]]; then
412+
export FH=$(( 10#${fhr} + 0 ))
413+
${GFSDOWNSHF}
414+
export err=$?; err_chk
415+
fi
416+
417+
if [[ "${SENDDBN}" = 'YES' ]]; then
418418
"${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2 "${job}" "${COMOUT}/${FLUXFL}"
419419
"${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2_WIDX "${job}" "${COMOUT}/${FLUXFLIDX}"
420420
fi
421421
fi
422422

423423
# process satellite look alike separately so that master pgb gets out in time
424424
# set outtyp to 2 because master post already generates gfs io files
425-
if [ "${GOESF}" = "YES" ]; then
425+
if [[ "${GOESF}" = "YES" ]]; then
426426
export OUTTYP=${OUTTYP:-4}
427427

428428
# specify output file name from chgres which is input file name to nceppost
@@ -436,7 +436,7 @@ else ## not_anl if_stime
436436
export FIXCRTM="${FIXCRTM:-${CRTM_FIX}}"
437437
"${USHgfs}/link_crtm_fix.sh" "${FIXCRTM}"
438438

439-
if [ "${GRIBVERSION}" = 'grib2' ]; then
439+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
440440
export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-GOES.txt"
441441
export CTLFILE="${PARMpost}/postcntrl_gfs_goes.xml"
442442
fi
@@ -449,24 +449,24 @@ else ## not_anl if_stime
449449
export JO=0
450450
export IGEN=0
451451

452-
if [ "${NET}" = "gfs" ]; then
452+
if [[ "${NET}" = "gfs" ]]; then
453453
${POSTGPSH}
454454
export err=$?; err_chk
455455
fi
456456

457-
if [ "${GRIBVERSION}" = 'grib2' ]; then
457+
if [[ "${GRIBVERSION}" = 'grib2' ]]; then
458458
SPECIALFL="${PREFIX}special.grb2"
459459
SPECIALFLIDX="${PREFIX}special.grb2i"
460460
fi
461461
fhr3=${fhr}
462462

463-
if [ "${SENDCOM}" = "YES" ]; then
463+
if [[ "${SENDCOM}" = "YES" ]]; then
464464
# echo "$PDY$cyc$pad$fhr" > $COMOUT/${RUN}.t${cyc}z.master.control
465465

466466
mv goesfile "${COMOUT}/${SPECIALFL}f${fhr}"
467467
mv goesifile "${COMOUT}/${SPECIALFLIDX}f${fhr}"
468468

469-
if [ "${SENDDBN}" = "YES" ]; then
469+
if [[ "${SENDDBN}" = "YES" ]]; then
470470
"${DBNROOT}/bin/dbn_alert" MODEL GFS_SPECIAL_GB2 "${job}" "${COMOUT}/${SPECIALFL}f${fhr}"
471471
fi
472472
fi
@@ -509,8 +509,8 @@ else ## not_anl if_stime
509509
if (( err != 0 )); then
510510
echo " *** GFS POST WARNING: WAFS output failed for f${fhr}, err=${err}"
511511
else
512-
if [ -e "${PGBOUT}" ]; then
513-
if [ "${SENDCOM}" = "YES" ]; then
512+
if [[ -e "${PGBOUT}" ]]; then
513+
if [[ "${SENDCOM}" = "YES" ]]; then
514514
cp "${PGBOUT}" "${COMOUT}/${PREFIX}wafs.grb2f${fhr}"
515515
cp "${PGIOUT}" "${COMOUT}/${PREFIX}wafs.grb2if${fhr}"
516516
fi

ush/inter_flux.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,13 @@ else
4343
fi
4444

4545
#---------------------------------------------------------------
46-
47-
if [ $INLINE_POST = ".false." ]; then
48-
$WGRIB2 $PGBOUT $option1 $option21 $option22 $option23 $option24 \
49-
$option25 $option26 $option27 $option28 \
50-
-new_grid $grid1p0 fluxfile_${fhr3}_1p00
51-
else
52-
$WGRIB2 $COMOUT/${FLUXFL} $option1 $option21 $option22 $option23 $option24 \
46+
$WGRIB2 $COMOUT/${FLUXFL} $option1 $option21 $option22 $option23 $option24 \
5347
$option25 $option26 $option27 $option28 \
5448
-new_grid $grid1p0 fluxfile_${fhr3}_1p00
55-
fi
5649
export err=$?; err_chk
5750

58-
5951
$WGRIB2 -s fluxfile_${fhr3}_1p00 > $COMOUT/${PREFIX}flux.1p00.f${fhr3}.idx
6052
cp fluxfile_${fhr3}_1p00 $COMOUT/${PREFIX}flux.1p00.f${fhr3}
61-
6253
#---------------------------------------------------------------
6354

6455

0 commit comments

Comments
 (0)