From 7523fc15d9ecd70e6d6b557b2c1a2adb3fa5b8eb Mon Sep 17 00:00:00 2001 From: "Xianwu.Xue" Date: Sun, 8 Jan 2023 20:20:41 -0500 Subject: [PATCH] Change tab to 2-spaces for prdgen scripts On branch feature/gefs_v13_atmos_prep modified: scripts/exgefs_atmos_prdgen.sh modified: ush/gefs_prdgen.sh modified: ush/gefs_prdgen_driver.sh Refs: #95 --- scripts/exgefs_atmos_prdgen.sh | 120 +++--- ush/gefs_prdgen.sh | 344 +++++++++--------- ush/gefs_prdgen_driver.sh | 641 +++++++++++++++++---------------- 3 files changed, 553 insertions(+), 552 deletions(-) diff --git a/scripts/exgefs_atmos_prdgen.sh b/scripts/exgefs_atmos_prdgen.sh index 3805bcc18..27cb60df9 100755 --- a/scripts/exgefs_atmos_prdgen.sh +++ b/scripts/exgefs_atmos_prdgen.sh @@ -4,8 +4,8 @@ echo "$(date -u) begin ${.sh.file}" set -xa if [[ ${STRICT:-NO} == "YES" ]]; then - # Turn on strict bash error checking - set -eu + # Turn on strict bash error checking + set -eu fi export RERUN=${RERUN:-RESTART} @@ -16,53 +16,53 @@ echo "PRDGEN_STREAMS = $PRDGEN_STREAMS" export overwrite=yes if [[ $SENDCOM == "YES" && $save_pgrb2_p5 == YES ]]; then - mkdir -m 775 -p $COMOUT/$COMPONENT/pgrb2p5 + mkdir -m 775 -p $COMOUT/$COMPONENT/pgrb2p5 fi if [[ $SENDCOM == "YES" && $save_pgrb2_p25 == YES ]]; then - mkdir -m 775 -p $COMOUT/$COMPONENT/pgrb2p25 + mkdir -m 775 -p $COMOUT/$COMPONENT/pgrb2p25 fi case ${FORECAST_SEGMENT:-none} in - hr) - start_hour=0 - end_hour=${fhmaxh} - ;; - lr) - start_hour=$((${fhmaxh}+1)) - end_hour=${fhmax} - PRDGEN_STREAMS=$PRDGEN_STREAMS_LR - ;; - *) - start_hour=0 - end_hour=${fhmaxh} - ;; + hr) + start_hour=0 + end_hour=${fhmaxh} + ;; + lr) + start_hour=$((${fhmaxh}+1)) + end_hour=${fhmax} + PRDGEN_STREAMS=$PRDGEN_STREAMS_LR + ;; + *) + start_hour=0 + end_hour=${fhmaxh} + ;; esac # $FORECAST_SEGMENT in for stream in ${PRDGEN_STREAMS[@]}; do - # Filter out hours based on forecast segment - typeset -a hours=($(echo ${PRDGEN_HOURS[$stream]})) - echo "hours = $hours" - for i in "${!hours[@]}"; do - hour=${hours[i]} - echo "i = $i hour = $hour" - if [[ $hour -lt $start_hour || $hour -gt $end_hour ]]; then - unset 'hours[i]' - fi - done - PRDGEN_HOURS[$stream]="${hours[@]}" - unset hours - - # Ensure required variables are defined - for var in PRDGEN_GRID PRDGEN_GRID_SPEC PRDGEN_HOURS PRDGEN_SUBMC PRDGEN_A_DIR PRDGEN_A_PREFIX PRDGEN_A_LIST_F00 PRDGEN_A_LIST_FHH; do - pointer="$var[$stream]" - if [[ -z ${!pointer} ]]; then - echo "FATAL ERROR in ${.sh.file}: $var not defined for $stream" - exit -1 - fi - done - - # Print out settings for this stream - cat <<-EOF + # Filter out hours based on forecast segment + typeset -a hours=($(echo ${PRDGEN_HOURS[$stream]})) + echo "hours = $hours" + for i in "${!hours[@]}"; do + hour=${hours[i]} + echo "i = $i hour = $hour" + if [[ $hour -lt $start_hour || $hour -gt $end_hour ]]; then + unset 'hours[i]' + fi + done + PRDGEN_HOURS[$stream]="${hours[@]}" + unset hours + + # Ensure required variables are defined + for var in PRDGEN_GRID PRDGEN_GRID_SPEC PRDGEN_HOURS PRDGEN_SUBMC PRDGEN_A_DIR PRDGEN_A_PREFIX PRDGEN_A_LIST_F00 PRDGEN_A_LIST_FHH; do + pointer="$var[$stream]" + if [[ -z ${!pointer} ]]; then + echo "FATAL ERROR in ${.sh.file}: $var not defined for $stream" + exit -1 + fi + done + + # Print out settings for this stream + cat <<-EOF Settings for prgden stream $stream: Grid: ${PRDGEN_GRID[$stream]} Grid Spec: ${PRDGEN_GRID_SPEC[$stream]} @@ -73,7 +73,7 @@ for stream in ${PRDGEN_STREAMS[@]}; do A Parmlist f00: ${PRDGEN_A_LIST_F00[$stream]} A Parmlist fhh: ${PRDGEN_A_LIST_FHH[$stream]} B Dir: ${PRDGEN_B_DIR[$stream]:-""} - B Prefix: ${PRDGEN_B_PREFIX[$stream]:-""} + B Prefix: ${PRDGEN_B_PREFIX[$stream]:-""} B Parmlist f00: ${PRDGEN_B_LIST_F00[$stream]:-""} B Parmlist fhh: ${PRDGEN_B_LIST_FHH[$stream]:-""} Do Anaylsis: ${PRDGEN_DO_ANALYSIS[$stream]:-"NO (default)"} @@ -86,21 +86,21 @@ done ################################# rm -f prdgen.cmdfile for stream in ${PRDGEN_STREAMS[@]}; do - if [[ $SENDCOM == "YES" ]]; then - mkdir -m 775 -p $COMOUT/$COMPONENT/${PRDGEN_A_DIR[${stream}]} - if [[ ! -z ${PRDGEN_B_DIR[$stream]} ]]; then - mkdir -m 775 -p $COMOUT/$COMPONENT/${PRDGEN_B_DIR[${stream}]} - fi - fi - - subdata=${DATA}/${stream} - if [ ! -d ${subdata} ]; then - mkdir -p ${subdata}; - fi - infile=${subdata}/${stream}.in - outfile=${subdata}/${stream}.out - - cat > ${infile} <<-EOF + if [[ $SENDCOM == "YES" ]]; then + mkdir -m 775 -p $COMOUT/$COMPONENT/${PRDGEN_A_DIR[${stream}]} + if [[ ! -z ${PRDGEN_B_DIR[$stream]} ]]; then + mkdir -m 775 -p $COMOUT/$COMPONENT/${PRDGEN_B_DIR[${stream}]} + fi + fi + + subdata=${DATA}/${stream} + if [ ! -d ${subdata} ]; then + mkdir -p ${subdata}; + fi + infile=${subdata}/${stream}.in + outfile=${subdata}/${stream}.out + + cat > ${infile} <<-EOF jobgrid="${PRDGEN_GRID[$stream]}" grid_spec="${PRDGEN_GRID_SPEC[$stream]}" hours="${PRDGEN_HOURS[$stream]}" @@ -116,7 +116,7 @@ for stream in ${PRDGEN_STREAMS[@]}; do do_analysis="${PRDGEN_DO_ANALYSIS[$stream]:-NO}" EOF - echo "$HOMEgefs/ush/gefs_prdgen_driver.sh $stream $subdata \"$infile\" 2>&1 >${outfile}" >> prdgen.cmdfile + echo "$HOMEgefs/ush/gefs_prdgen_driver.sh $stream $subdata \"$infile\" 2>&1 >${outfile}" >> prdgen.cmdfile done @@ -134,8 +134,8 @@ $APRUN_MPMD export err=$? if [[ $err != 0 ]]; then - echo "FATAL ERROR in ${.sh.file}: One or more prdgen streams in $MP_CMDFILE failed!" - exit $err + echo "FATAL ERROR in ${.sh.file}: One or more prdgen streams in $MP_CMDFILE failed!" + exit $err fi ############################################################# diff --git a/ush/gefs_prdgen.sh b/ush/gefs_prdgen.sh index 529133ba9..417ff4638 100755 --- a/ush/gefs_prdgen.sh +++ b/ush/gefs_prdgen.sh @@ -28,192 +28,192 @@ export ENSADD=${ENSADD:-$USHgefs/global_ensadd.sh} cat <<-EOF Settings for ${.sh.file}: - RUNMEM: $RUNMEM - DATA: $DATA - - mafile: $mafile - mifile: $mifile - mcfile: $mcfile - pcfile: $pcfile - - parmlist_a: $parmlist_a - parmlist_b: $parmlist_b - - fileaout: $fileaout - fileaouti: $fileaouti - filebout: $filebout - filebouti: $filebouti - - WGRIB2: $WGRIB2 - COPYGB2: $COPYGB2 - makepgrb2b: $makepgrb2b - - option1: $option1 - option21: $option21 - option22: $option22 - option23: $option23 + RUNMEM: $RUNMEM + DATA: $DATA + + mafile: $mafile + mifile: $mifile + mcfile: $mcfile + pcfile: $pcfile + + parmlist_a: $parmlist_a + parmlist_b: $parmlist_b + + fileaout: $fileaout + fileaouti: $fileaouti + filebout: $filebout + filebouti: $filebouti + + WGRIB2: $WGRIB2 + COPYGB2: $COPYGB2 + makepgrb2b: $makepgrb2b + + option1: $option1 + option21: $option21 + option22: $option22 + option23: $option23 EOF if (( fhr == 0 )); then - hsuffix="00" + hsuffix="00" else - hsuffix="hh" + hsuffix="hh" fi if [ "$jobgrid" = '2p5' ]; then - SENDDBN=NO + SENDDBN=NO fi #################################### # Step I: Create pgrb2 files #################################### if [[ -s $DATA/pgrb2$ffhr && $overwrite = no ]]; then - echo "$jobgrid pgrb2 processing skipped for $RUNMEM $ffhr" + echo "$jobgrid pgrb2 processing skipped for $RUNMEM $ffhr" else - $WGRIB2 $mafile $option1 $option21 $option22 $option23 $option24 \ - $option25 $option26 $option27 $option28 \ - -new_grid $grid_spec pgb2file.$ffhr - export err=$? - if [[ $err -ne 0 ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): wgrib2 for $mafile failed!" - export err=1 - err_chk || exit $err - fi - echo "$(date) pgrb2 $jobgrid grbfile $ffhr completed" - - ###################################################### - # Split the pgb2 file into pgrb2a, pgrb2b and pgrb2d parts - ###################################################### - # set +x - - excludestring=${excludestring:-'372-384hr'} - - $WGRIB2 -s pgb2file.$ffhr | \ - grep -F -f $parmlist_a | \ - grep -v -F $excludestring | \ - $WGRIB2 -s pgb2file.$ffhr -i -grib pgb2afile.$ffhr - if [[ $RUNMEM = "gegfs" ]]; then - if (( fhr >= 3 )); then - rm exlist - $WGRIB2 -s pgb2afile.$ffhr | grep -e CSN -e CIC -e CFR -e CRA | grep "hour fcst" > exlist - if (( fhr > 6 )); then - $WGRIB2 -s pgb2afile.$ffhr | grep "APCP" | grep ":0-" >> exlist - fi - $WGRIB2 -s pgb2afile.$ffhr | grep -v -f exlist | $WGRIB2 -i pgb2afile.$ffhr -grib tmpfile - mv tmpfile pgb2afile.$ffhr - fi - fi - if [[ x$fhoroglist != x ]]; then - for fhorog in $fhoroglist; do - if (( fhr == fhorog )); then - $WGRIB2 -s pgb2file.$ffhr | grep 'HGT:surface' | $WGRIB2 pgb2file.$ffhr -i -append -grib pgb2afile.$ffhr - fi - done # for fhorog in $fhoroglist - fi # [[ x$fhoroglist != x ]] - $WGRIB2 -s pgb2afile.$ffhr > pgb2afile.${ffhr}.idx - if [[ $RUNMEM = "gegfs" ]]; then - # Add ensemble PDS header to GFS file - $ENSADD 0 0 pgb2afile.$ffhr epgbafile - mv epgbafile pgb2afile.$ffhr - fi # [[ $RUNMEM = "gegfs" ]] - - if [[ $makepgrb2b = "yes" ]]; then - $WGRIB2 -s pgb2file.$ffhr | \ - grep -F -f $parmlist_b | \ - grep -v -F -f $parmlist_a | \ - grep -v -F $excludestring | \ - $WGRIB2 pgb2file.$ffhr -s -i -grib pgb2bfile.$ffhr - $WGRIB2 -s pgb2bfile.$ffhr > pgb2bfile.${ffhr}.idx - fi # [[ $makepgrb2b = "yes" ]] - - ############################################## - # Save the master files at 0p5 grid for fcst beyond day 10 - ############################################## - if [ "$save_pgrb2_p5" = 'YES' -a "$jobgrid" = '0p5' ]; then - if (( fhr > FHMAXHF )); then - $WGRIB2 -s pgb2file.$ffhr > pgb2file.${ffhr}.idx - mv pgb2file.${ffhr} $mafile_p5 - mv pgb2file.${ffhr}.idx $mifile_p5 - fi - fi - if [ "$save_pgrb2_p25" = 'YES' -a "$jobgrid" = '0p25' ]; then - if (( fhr <= FHMAXHF )); then - $WGRIB2 -s pgb2file.$ffhr > pgb2file.${ffhr}.idx - mv pgb2file.${ffhr} $mafile_p25 - mv pgb2file.${ffhr}.idx $mifile_p25 - fi - fi - - ############################################## - # Save Data - ############################################## - if [[ "$SENDCOM" = 'YES' ]]; then - # - # Save Pressure GRIB/Index files - # - mv pgb2afile.$ffhr $fileaout - testfile=$fileaout - if [[ ! -s $testfile ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" - export err=1 - err_chk || exit $err - fi # [[ ! -s $testfile ]] - - if [[ "$makegrb2i" = "yes" ]]; then - mv pgb2afile.$ffhr.idx $fileaouti - testfile=$fileaouti - if [[ ! -s $testfile ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" - export err=1 - err_chk || exit $err - fi # [[ ! -s $testfile ]] - fi - - if [[ $makepgrb2b = "yes" ]]; then - mv pgb2bfile.$ffhr $filebout - testfile=$filebout - if [[ ! -s $testfile ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" - export err=1 - err_chk || exit $err - fi # [[ ! -s $testfile ]] - - if [[ "$makegrb2i" = "yes" ]]; then - mv pgb2bfile.$ffhr.idx $filebouti - testfile=$filebouti - if [[ ! -s $testfile ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" - export err=1 - err_chk || exit $err - fi # [[ ! -s $testfile ]] - fi # [[ "$makegrb2i" = "yes" ]] - fi # [[ $makepgrb2b = "yes" ]] - - ############################################################################### - # Send DBNet alerts for PGB2A all forecast hours for 00, 06, 12, and 18Z cycles. - ############################################################################### - MODCOM=$(echo ${NET}_${COMPONENT} | tr '[a-z]' '[A-Z]') - GRID=$(echo ${GRID} | tr '[a-z]' '[A-Z]') - if [[ "$SENDDBN" = 'YES' ]]; then - DBNTYP=${MODCOM}_PGB2A - if [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]]; then - $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID $job $fileaout - $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID\_IDX $job $fileaouti - fi # [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]] - fi # [[ "$SENDDBN" = 'YES' ]] - - ############################################################################### - # Send DBNet alerts for PGB2B - ############################################################################### - if [[ "$SENDDBN" = 'YES' && "$jobgrid" = '0p5' && "$makepgrb2b" = "yes" ]]; then - DBNTYP=${MODCOM}_PGB2B - if [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]]; then - $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID $job $filebout - $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID\_IDX $job $filebouti - fi # [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]] - fi # [[ "$SENDDBN" = 'YES' ]] - fi # [[ "$SENDCOM" = 'YES' ]] - echo $(date) pgrb2a $jobgrid sendcom $ffhr completed + $WGRIB2 $mafile $option1 $option21 $option22 $option23 $option24 \ + $option25 $option26 $option27 $option28 \ + -new_grid $grid_spec pgb2file.$ffhr + export err=$? + if [[ $err -ne 0 ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): wgrib2 for $mafile failed!" + export err=1 + err_chk || exit $err + fi + echo "$(date) pgrb2 $jobgrid grbfile $ffhr completed" + + ###################################################### + # Split the pgb2 file into pgrb2a, pgrb2b and pgrb2d parts + ###################################################### + # set +x + + excludestring=${excludestring:-'372-384hr'} + + $WGRIB2 -s pgb2file.$ffhr | \ + grep -F -f $parmlist_a | \ + grep -v -F $excludestring | \ + $WGRIB2 -s pgb2file.$ffhr -i -grib pgb2afile.$ffhr + if [[ $RUNMEM = "gegfs" ]]; then + if (( fhr >= 3 )); then + rm exlist + $WGRIB2 -s pgb2afile.$ffhr | grep -e CSN -e CIC -e CFR -e CRA | grep "hour fcst" > exlist + if (( fhr > 6 )); then + $WGRIB2 -s pgb2afile.$ffhr | grep "APCP" | grep ":0-" >> exlist + fi + $WGRIB2 -s pgb2afile.$ffhr | grep -v -f exlist | $WGRIB2 -i pgb2afile.$ffhr -grib tmpfile + mv tmpfile pgb2afile.$ffhr + fi + fi + if [[ x$fhoroglist != x ]]; then + for fhorog in $fhoroglist; do + if (( fhr == fhorog )); then + $WGRIB2 -s pgb2file.$ffhr | grep 'HGT:surface' | $WGRIB2 pgb2file.$ffhr -i -append -grib pgb2afile.$ffhr + fi + done # for fhorog in $fhoroglist + fi # [[ x$fhoroglist != x ]] + $WGRIB2 -s pgb2afile.$ffhr > pgb2afile.${ffhr}.idx + if [[ $RUNMEM = "gegfs" ]]; then + # Add ensemble PDS header to GFS file + $ENSADD 0 0 pgb2afile.$ffhr epgbafile + mv epgbafile pgb2afile.$ffhr + fi # [[ $RUNMEM = "gegfs" ]] + + if [[ $makepgrb2b = "yes" ]]; then + $WGRIB2 -s pgb2file.$ffhr | \ + grep -F -f $parmlist_b | \ + grep -v -F -f $parmlist_a | \ + grep -v -F $excludestring | \ + $WGRIB2 pgb2file.$ffhr -s -i -grib pgb2bfile.$ffhr + $WGRIB2 -s pgb2bfile.$ffhr > pgb2bfile.${ffhr}.idx + fi # [[ $makepgrb2b = "yes" ]] + + ############################################## + # Save the master files at 0p5 grid for fcst beyond day 10 + ############################################## + if [ "$save_pgrb2_p5" = 'YES' -a "$jobgrid" = '0p5' ]; then + if (( fhr > FHMAXHF )); then + $WGRIB2 -s pgb2file.$ffhr > pgb2file.${ffhr}.idx + mv pgb2file.${ffhr} $mafile_p5 + mv pgb2file.${ffhr}.idx $mifile_p5 + fi + fi + if [ "$save_pgrb2_p25" = 'YES' -a "$jobgrid" = '0p25' ]; then + if (( fhr <= FHMAXHF )); then + $WGRIB2 -s pgb2file.$ffhr > pgb2file.${ffhr}.idx + mv pgb2file.${ffhr} $mafile_p25 + mv pgb2file.${ffhr}.idx $mifile_p25 + fi + fi + + ############################################## + # Save Data + ############################################## + if [[ "$SENDCOM" = 'YES' ]]; then + # + # Save Pressure GRIB/Index files + # + mv pgb2afile.$ffhr $fileaout + testfile=$fileaout + if [[ ! -s $testfile ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" + export err=1 + err_chk || exit $err + fi # [[ ! -s $testfile ]] + + if [[ "$makegrb2i" = "yes" ]]; then + mv pgb2afile.$ffhr.idx $fileaouti + testfile=$fileaouti + if [[ ! -s $testfile ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" + export err=1 + err_chk || exit $err + fi # [[ ! -s $testfile ]] + fi + + if [[ $makepgrb2b = "yes" ]]; then + mv pgb2bfile.$ffhr $filebout + testfile=$filebout + if [[ ! -s $testfile ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" + export err=1 + err_chk || exit $err + fi # [[ ! -s $testfile ]] + + if [[ "$makegrb2i" = "yes" ]]; then + mv pgb2bfile.$ffhr.idx $filebouti + testfile=$filebouti + if [[ ! -s $testfile ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): $testfile WAS NOT WRITTEN" + export err=1 + err_chk || exit $err + fi # [[ ! -s $testfile ]] + fi # [[ "$makegrb2i" = "yes" ]] + fi # [[ $makepgrb2b = "yes" ]] + + ############################################################################### + # Send DBNet alerts for PGB2A all forecast hours for 00, 06, 12, and 18Z cycles. + ############################################################################### + MODCOM=$(echo ${NET}_${COMPONENT} | tr '[a-z]' '[A-Z]') + GRID=$(echo ${GRID} | tr '[a-z]' '[A-Z]') + if [[ "$SENDDBN" = 'YES' ]]; then + DBNTYP=${MODCOM}_PGB2A + if [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]]; then + $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID $job $fileaout + $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID\_IDX $job $fileaouti + fi # [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]] + fi # [[ "$SENDDBN" = 'YES' ]] + + ############################################################################### + # Send DBNet alerts for PGB2B + ############################################################################### + if [[ "$SENDDBN" = 'YES' && "$jobgrid" = '0p5' && "$makepgrb2b" = "yes" ]]; then + DBNTYP=${MODCOM}_PGB2B + if [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]]; then + $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID $job $filebout + $DBNROOT/bin/dbn_alert MODEL ${DBNTYP}_$GRID\_IDX $job $filebouti + fi # [[ $(echo $RUNMEM | cut -c1-2) = "ge" ]] + fi # [[ "$SENDDBN" = 'YES' ]] + fi # [[ "$SENDCOM" = 'YES' ]] + echo $(date) pgrb2a $jobgrid sendcom $ffhr completed fi # [[ -s $DATA/pgrb2$ffhr ]] && [[ $overwrite = no ]] echo "$(date -u) end ${.sh.file}" diff --git a/ush/gefs_prdgen_driver.sh b/ush/gefs_prdgen_driver.sh index 0973f1097..8a22d9e21 100755 --- a/ush/gefs_prdgen_driver.sh +++ b/ush/gefs_prdgen_driver.sh @@ -20,8 +20,8 @@ export PS4="${PS4}${1}: " set -xa if [[ ${STRICT:-NO} == "YES" ]]; then - # Turn on strict bash error checking - set -eu + # Turn on strict bash error checking + set -eu fi export VERBOSE=yes @@ -38,6 +38,7 @@ export infile="${3}" # ${DATA}/${stream}/${stream}.in # grid_spec= # PRDGEN_GRID_SPEC[$stream] # hours= # PRDGEN_HOURS[$stream] # submc= # PRDGEN_SUBMC[$stream] +# submc= # PRDGEN_SUBMC[$stream] # pgad= # PRDGEN_A_DIR[$stream] # pgapre= # PRDGEN_A_PREFIX[$stream] # parmlist_a00= # PRDGEN_A_LIST_F00[$stream] @@ -50,24 +51,24 @@ export infile="${3}" # ${DATA}/${stream}/${stream}.in cat <<-EOF Settings for $(basename ${.sh.file}) stream $stream: - RUNMEM: $RUNMEM - cyc: $cyc - DATA: $DATA - - jobdir: $jobdir - jobgrid: $jobgrid - grid_spec: $grid_spec - hours: ($hours) - submc: $submc - pgad: $pgad - pgapre: $pgapre - parmlist_a00: $parmlist_a00 - parmlist_ahh: $parmlist_ahh - pgbd: $pgbd - pgbpre: $pgbpre - parmlist_b00: $parmlist_b00 - parmlist_bhh: $parmlist_bhh - do_analysis: $do_analysis + RUNMEM: $RUNMEM + cyc: $cyc + DATA: $DATA + + jobdir: $jobdir + jobgrid: $jobgrid + grid_spec: $grid_spec + hours: ($hours) + submc: $submc + pgad: $pgad + pgapre: $pgapre + parmlist_a00: $parmlist_a00 + parmlist_ahh: $parmlist_ahh + pgbd: $pgbd + pgbpre: $pgbpre + parmlist_b00: $parmlist_b00 + parmlist_bhh: $parmlist_bhh + do_analysis: $do_analysis EOF @@ -79,18 +80,18 @@ CDUMP="gefs" #${RUNMEM} # clean up missing markers from previous run ############################################################ if [[ $SENDCOM == "YES" ]]; then - mkdir -m 775 -p $COMOUT/$COMPONENT/misc/$submc - cd $COMOUT/$COMPONENT/misc/$submc - - rc=$? - if (( rc == 0 )); then - for file in $RUNMEM.*.missing; do - if [[ -f $file ]]; then - echo "Removing $COMOUT/$COMPONENT/misc/$submc/$file" - rm -f $COMOUT/$COMPONENT/misc/$submc/$file - fi - done # for file in $RUNMEM.*.missing - fi # (( rc == 0 )) + mkdir -m 775 -p $COMOUT/$COMPONENT/misc/$submc + cd $COMOUT/$COMPONENT/misc/$submc + + rc=$? + if (( rc == 0 )); then + for file in $RUNMEM.*.missing; do + if [[ -f $file ]]; then + echo "Removing $COMOUT/$COMPONENT/misc/$submc/$file" + rm -f $COMOUT/$COMPONENT/misc/$submc/$file + fi + done # for file in $RUNMEM.*.missing + fi # (( rc == 0 )) fi cd $jobdir @@ -98,307 +99,307 @@ cd $jobdir SLEEP_LOOP_MAX=$(($SLEEP_TIME / $SLEEP_INT)) for hour in $hours; do - if [[ $do_analysis = YES ]] && (( hour == 0 )); then - export ffhr=anl - export fhr=000 - - if [[ $RUNMEM = "gegfs" ]]; then - export mafile=$COMINgfs/gfs.$cycle.master.grb2anl - export mifile=$COMINgfs/gfs.$cycle.master.grb2ianl - export mcfile="" - export makepgrb2b="no" - else - export mafile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2anl - export mifile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2ianl - export mcfile=$COMIN/misc/post/${CDUMP}.$cycle.master.control.anl - if [[ -z "$pgbd" ]]; then - export makepgrb2b="no" - else - export makepgrb2b="yes" - fi - fi # [[ $RUNMEM = "gegfs" ]] - - if [[ $SENDCOM == "YES" ]]; then - export pcfile=$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.$cycle.prdgen.control.anl - export fileaout=$COMOUT/$COMPONENT/$pgad/${CDUMP}.$cycle.${pgapre}anl - export fileaouti=${fileaout}.idx - export filebout=$COMOUT/$COMPONENT/$pgbd/${CDUMP}.$cycle.${pgbpre}anl - export filebouti=${filebout}.idx - else - export pcfile=$DATA/$submc/${CDUMP}.$cycle.prdgen.control.anl - export fileaout=$DATA/${CDUMP}.$cycle.${pgapre}anl - export fileaouti=${fileaout}.idx - export filebout=$DATA/${CDUMP}.$cycle.${pgbpre}anl - export filebouti=${filebout}.idx - fi - - ic=1 - while [ $ic -le $SLEEP_LOOP_MAX ]; do - if [[ $RUNMEM = "gegfs" ]]; then - # Assume GFS is complete - if [[ -f $mifile ]]; then - break - fi - else - # Check if control file has been created, to make sure file is complete before using - testfhr=-1 - if [[ -f $mcfile ]]; then - teststring=$(cat $mcfile|head -1) - if [[ $teststring != '' ]]; then - if [[ -f $mifile ]]; then - testfhr=$(echo $teststring | cut -c11-13) - fi - fi # [[ $teststring != '' ]] - fi # [[ -f $mcfile ]] - echo "testfhr=$testfhr fhr=$fhr" - - if (( testfhr >= fhr )); then - break - fi # (( testfhr >= fhr )) - fi - - ic=$(expr $ic + 1) - sleep $SLEEP_INT - - ############################### - # If we reach this point assume - # fcst job never reached restart - # period and write file to - # indicate missing data - ############################### - if [ $ic -eq $SLEEP_LOOP_MAX ]; then - if [[ $SENDCOM == "YES" ]]; then - date >$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.t${cyc}z.anl.missing - fi - sDate=$(date) - cat <<-EOF + if [[ $do_analysis = YES ]] && (( hour == 0 )); then + export ffhr=anl + export fhr=000 + + if [[ $RUNMEM = "gegfs" ]]; then + export mafile=$COMINgfs/gfs.$cycle.master.grb2anl + export mifile=$COMINgfs/gfs.$cycle.master.grb2ianl + export mcfile="" + export makepgrb2b="no" + else + export mafile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2anl + export mifile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2ianl + export mcfile=$COMIN/misc/post/${CDUMP}.$cycle.master.control.anl + if [[ -z "$pgbd" ]]; then + export makepgrb2b="no" + else + export makepgrb2b="yes" + fi + fi # [[ $RUNMEM = "gegfs" ]] + + if [[ $SENDCOM == "YES" ]]; then + export pcfile=$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.$cycle.prdgen.control.anl + export fileaout=$COMOUT/$COMPONENT/$pgad/${CDUMP}.$cycle.${pgapre}anl + export fileaouti=${fileaout}.idx + export filebout=$COMOUT/$COMPONENT/$pgbd/${CDUMP}.$cycle.${pgbpre}anl + export filebouti=${filebout}.idx + else + export pcfile=$DATA/$submc/${CDUMP}.$cycle.prdgen.control.anl + export fileaout=$DATA/${CDUMP}.$cycle.${pgapre}anl + export fileaouti=${fileaout}.idx + export filebout=$DATA/${CDUMP}.$cycle.${pgbpre}anl + export filebouti=${filebout}.idx + fi + + ic=1 + while [ $ic -le $SLEEP_LOOP_MAX ]; do + if [[ $RUNMEM = "gegfs" ]]; then + # Assume GFS is complete + if [[ -f $mifile ]]; then + break + fi + else + # Check if control file has been created, to make sure file is complete before using + testfhr=-1 + if [[ -f $mcfile ]]; then + teststring=$(cat $mcfile|head -1) + if [[ $teststring != '' ]]; then + if [[ -f $mifile ]]; then + testfhr=$(echo $teststring | cut -c11-13) + fi + fi # [[ $teststring != '' ]] + fi # [[ -f $mcfile ]] + echo "testfhr=$testfhr fhr=$fhr" + + if (( testfhr >= fhr )); then + break + fi # (( testfhr >= fhr )) + fi + + ic=$(expr $ic + 1) + sleep $SLEEP_INT + + ############################### + # If we reach this point assume + # fcst job never reached restart + # period and write file to + # indicate missing data + ############################### + if [ $ic -eq $SLEEP_LOOP_MAX ]; then + if [[ $SENDCOM == "YES" ]]; then + date >$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.t${cyc}z.anl.missing + fi + sDate=$(date) + cat <<-EOF FATAL ERROR in ${.sh.file} ($stream): Post data still missing for analysis at $sDate after waiting ${SLEEP_TIME}s. Looked for the following files: $(set +x; if [[ $RUNMEM != "gegfs" ]]; then Control file: $mcfile $(if [[ -f $mcfile ]]; then echo "exists"; else; echo "doesn't exist"; fi); fi) Grib file: $mafile $(set +x; if [[ -f $mafile ]]; then echo "exists"; else; echo "doesn't exist"; fi) Index file: $mifile $(set +x; if [[ -f $mifile ]]; then echo "exists"; else; echo "doesn't exist"; fi) EOF - export err=1; - err_chk - exit $err - fi # [ $ic -eq $SLEEP_LOOP_MAX ] - - done # [ $ic -le $SLEEP_LOOP_MAX ] - - # - # If control file already exists and skip if all output also present, otherwise - # delete control file to rerun. - # - if [[ -s $pcfile ]]; then - nmissing=0 - check_files="$fileaout $fileaouti" - if [[ makepgrb2b == "yes" ]]; then - check_files="$check_files $filebout $filebouti" - fi - for file in $check_files ; do - if [[ ! -s $file ]]; then - echo "file=$file IS MISSING" - (( nmissing = nmissing + 1 )) - fi - done # for file in $fileaout $fileaouti $filebout $filebouti - if (( nmissing > 0 )) || [[ $RERUN == "YES" ]]; then - rm $pcfile - fi - else - nmissing=1 - fi # [[ -s $pcfile ]] - - if [[ ! -s $pcfile ]]; then - export parmlist_a=$parmlist_a00 - export parmlist_b=$parmlist_b00 - - $USHgefs/gefs_prdgen.sh - - # Check for error - export err=$? - if [[ $err != 0 ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): Creation of product failed for analysis!" - err_chk - exit $err - fi - - #################################### - # send control files to misc - #################################### - if [[ $SENDCOM == "YES" ]]; then - echo "$PDY$cyc$fhr" > $pcfile - fi # [[ $SENDCOM == "YES" ]] - fi # [[ ! -s $pcfile ]] - fi # [[ $do_analysis = YES ]] && (( hour == 0 )) - - export fhr=$(printf "%03.0f" $hour) # Zero-pad to three places - export ffhr="f${fhr}" - # GFS output is only every 12 hours after 240, skip the unwanted hours - if [[ $RUNMEM = "gegfs" ]] && (( fhr > gfsfhmaxh )) && (( fhr%12 == 6 )); then - echo "fhr=$fhr not expected for GFS" - continue - fi - - ############################### - # Start Looping for the - # existence of the restart files - ############################### - export pgm="postcheck" - - if [[ $RUNMEM = "gegfs" ]]; then - export mafile=$COMINgfs/gfs.$cycle.master.grb2f$fhr - export mifile=$COMINgfs/gfs.$cycle.master.grb2if$fhr - export mcfile="" - export makepgrb2b="no" - else - export mafile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2f$fhr - export mifile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2if$fhr #${mafile} - export mcfile=${COMIN}/$COMPONENT/misc/post/${CDUMP}.$cycle.master.control.f$fhr #${mafile} - if [[ -z "$pgbd" ]]; then - export makepgrb2b="no" - else - export makepgrb2b="yes" - fi - fi # [[ $RUNMEM = "gegfs" ]] - - if [[ $SENDCOM == "YES" ]]; then - export pcfile=$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.t${cyc}z.prdgen.control.f$fhr - export fileaout=$COMOUT/$COMPONENT/$pgad/${CDUMP}.$cycle.${pgapre}f${fhr} - export fileaouti=${fileaout}.idx - if [[ $RUNMEM = "geaer" ]]; then - export fileaout=$COMOUT/$pgad/${NET}.${COMPONENT}.$cycle.${pgapre}f${fhr}.grib2 - export fileaouti=${fileaout}.idx - fi - export filebout=$COMOUT/$COMPONENT/$pgbd/${CDUMP}.$cycle.${pgbpre}f${fhr} - export filebouti=${filebout}.idx - else - export pcfile=$DATA/$submc/${CDUMP}.t${cyc}z.prdgen.control.f$fhr - export fileaout=$DATA/${CDUMP}.$cycle.${pgapre}f${fhr} - export fileaouti=${fileaout}.idx - export filebout=$DATA/${CDUMP}.$cycle.${pgbpre}f${fhr} - export filebouti=${filebout}.idx - fi - - if [[ $SENDCOM == "YES" && $save_pgrb2_p5 = YES ]] && (( FHOUR > FHMAXHF )); then - export mafile_p5=$COMOUT/$COMPONENT/pgrb2p5/${CDUMP}.$cycle.pgrb2.0p50.f${fhr} - export mifile_p5=${mafile_p5}.idx - fi - if [[ $SENDCOM == "YES" && $save_pgrb2_p25 = YES ]] && (( FHOUR <= FHMAXHF )); then - export mafile_p25=$COMOUT/$COMPONENT/pgrb2p25/${CDUMP}.$cycle.pgrb2.0p25.f${fhr} - export mifile_p25=${mifile_p25}.idx - fi - - ic=1 - found="no" - while [ $ic -le $SLEEP_LOOP_MAX ]; do - if [[ $RUNMEM = "gegfs" ]]; then - # Check if index file has been created, to make sure file is complete before using - if [[ -f $mifile ]]; then - found="yes" - break - fi # [[ -f $mafile ]] - else # [[ $RUNMEM = "gegfs" ]] - # Check if control file has been created, to make sure file is complete before using - testfhr=-1 - if [[ -f $mcfile ]]; then - teststring=$(cat $mcfile|head -1) - if [[ $teststring != '' ]]; then - if [[ -f $mifile ]]; then - testfhr=$(echo $teststring | cut -c11-13) - fi - fi # [[ $teststring != '' ]] - fi # [[ -f $mcfile ]] + export err=1; + err_chk + exit $err + fi # [ $ic -eq $SLEEP_LOOP_MAX ] + + done # [ $ic -le $SLEEP_LOOP_MAX ] + + # + # If control file already exists and skip if all output also present, otherwise + # delete control file to rerun. + # + if [[ -s $pcfile ]]; then + nmissing=0 + check_files="$fileaout $fileaouti" + if [[ makepgrb2b == "yes" ]]; then + check_files="$check_files $filebout $filebouti" + fi + for file in $check_files ; do + if [[ ! -s $file ]]; then + echo "file=$file IS MISSING" + (( nmissing = nmissing + 1 )) + fi + done # for file in $fileaout $fileaouti $filebout $filebouti + if (( nmissing > 0 )) || [[ $RERUN == "YES" ]]; then + rm $pcfile + fi + else + nmissing=1 + fi # [[ -s $pcfile ]] + + if [[ ! -s $pcfile ]]; then + export parmlist_a=$parmlist_a00 + export parmlist_b=$parmlist_b00 + + $USHgefs/gefs_prdgen.sh + + # Check for error + export err=$? + if [[ $err != 0 ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): Creation of product failed for analysis!" + err_chk + exit $err + fi + + #################################### + # send control files to misc + #################################### + if [[ $SENDCOM == "YES" ]]; then + echo "$PDY$cyc$fhr" > $pcfile + fi # [[ $SENDCOM == "YES" ]] + fi # [[ ! -s $pcfile ]] + fi # [[ $do_analysis = YES ]] && (( hour == 0 )) + + export fhr=$(printf "%03.0f" $hour) # Zero-pad to three places + export ffhr="f${fhr}" + # GFS output is only every 12 hours after 240, skip the unwanted hours + if [[ $RUNMEM = "gegfs" ]] && (( fhr > gfsfhmaxh )) && (( fhr%12 == 6 )); then + echo "fhr=$fhr not expected for GFS" + continue + fi + + ############################### + # Start Looping for the + # existence of the restart files + ############################### + export pgm="postcheck" + + if [[ $RUNMEM = "gegfs" ]]; then + export mafile=$COMINgfs/gfs.$cycle.master.grb2f$fhr + export mifile=$COMINgfs/gfs.$cycle.master.grb2if$fhr + export mcfile="" + export makepgrb2b="no" + else + export mafile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2f$fhr + export mifile=${COMIN}/$COMPONENT/${CDUMP}.$cycle.master.grb2if$fhr #${mafile} + export mcfile=${COMIN}/$COMPONENT/misc/post/${CDUMP}.$cycle.master.control.f$fhr #${mafile} + if [[ -z "$pgbd" ]]; then + export makepgrb2b="no" + else + export makepgrb2b="yes" + fi + fi # [[ $RUNMEM = "gegfs" ]] + + if [[ $SENDCOM == "YES" ]]; then + export pcfile=$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.t${cyc}z.prdgen.control.f$fhr + export fileaout=$COMOUT/$COMPONENT/$pgad/${CDUMP}.$cycle.${pgapre}f${fhr} + export fileaouti=${fileaout}.idx + if [[ $RUNMEM = "geaer" ]]; then + export fileaout=$COMOUT/$pgad/${NET}.${COMPONENT}.$cycle.${pgapre}f${fhr}.grib2 + export fileaouti=${fileaout}.idx + fi + export filebout=$COMOUT/$COMPONENT/$pgbd/${CDUMP}.$cycle.${pgbpre}f${fhr} + export filebouti=${filebout}.idx + else + export pcfile=$DATA/$submc/${CDUMP}.t${cyc}z.prdgen.control.f$fhr + export fileaout=$DATA/${CDUMP}.$cycle.${pgapre}f${fhr} + export fileaouti=${fileaout}.idx + export filebout=$DATA/${CDUMP}.$cycle.${pgbpre}f${fhr} + export filebouti=${filebout}.idx + fi + + if [[ $SENDCOM == "YES" && $save_pgrb2_p5 = YES ]] && (( FHOUR > FHMAXHF )); then + export mafile_p5=$COMOUT/$COMPONENT/pgrb2p5/${CDUMP}.$cycle.pgrb2.0p50.f${fhr} + export mifile_p5=${mafile_p5}.idx + fi + if [[ $SENDCOM == "YES" && $save_pgrb2_p25 = YES ]] && (( FHOUR <= FHMAXHF )); then + export mafile_p25=$COMOUT/$COMPONENT/pgrb2p25/${CDUMP}.$cycle.pgrb2.0p25.f${fhr} + export mifile_p25=${mifile_p25}.idx + fi + + ic=1 + found="no" + while [ $ic -le $SLEEP_LOOP_MAX ]; do + if [[ $RUNMEM = "gegfs" ]]; then + # Check if index file has been created, to make sure file is complete before using + if [[ -f $mifile ]]; then + found="yes" + break + fi # [[ -f $mafile ]] + else # [[ $RUNMEM = "gegfs" ]] + # Check if control file has been created, to make sure file is complete before using + testfhr=-1 + if [[ -f $mcfile ]]; then + teststring=$(cat $mcfile|head -1) + if [[ $teststring != '' ]]; then + if [[ -f $mifile ]]; then + testfhr=$(echo $teststring | cut -c11-13) + fi + fi # [[ $teststring != '' ]] + fi # [[ -f $mcfile ]] #testfhr=999 - echo "testfhr=$testfhr fhr=$fhr" - - if (( testfhr >= fhr )); then - found="yes" - break - fi # (( testfhr >= fhr )) - fi # [[ $RUNMEM = "gegfs" ]] - - ic=$((ic + 1)) - sleep $SLEEP_INT - - ############################### - # If we reach this point assume - # fcst job never reached restart - # period and error exit - ############################### - if [ $ic -eq $SLEEP_LOOP_MAX ]; then - if [[ $SENDCOM == "YES" ]]; then - date >$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.t${cyc}z.f$fhr.missing - fi - sDate=$(date) - cat <<-EOF + echo "testfhr=$testfhr fhr=$fhr" + + if (( testfhr >= fhr )); then + found="yes" + break + fi # (( testfhr >= fhr )) + fi # [[ $RUNMEM = "gegfs" ]] + + ic=$((ic + 1)) + sleep $SLEEP_INT + + ############################### + # If we reach this point assume + # fcst job never reached restart + # period and error exit + ############################### + if [ $ic -eq $SLEEP_LOOP_MAX ]; then + if [[ $SENDCOM == "YES" ]]; then + date >$COMOUT/$COMPONENT/misc/$submc/${CDUMP}.t${cyc}z.f$fhr.missing + fi + sDate=$(date) + cat <<-EOF FATAL ERROR in ${.sh.file} ($stream): Post data still missing for f$fhr at $sDate after waiting ${SLEEP_TIME}s. Looked for the following files: Control file: $mcfile $(set +x; if [[ -f $mcfile ]]; then echo "exists"; else; echo "doesn't exist"; fi) Grib file: $mafile $(set +x; if [[ -f $mafile ]]; then echo "exists"; else; echo "doesn't exist"; fi) Index file: $mifile $(set +x; if [[ -f $mifile ]]; then echo "exists"; else; echo "doesn't exist"; fi) EOF - export err=1; - err_chk - exit $err - fi # [ $ic -eq $SLEEP_LOOP_MAX ] - done # while [ $ic -le $SLEEP_LOOP_MAX ] - - if [[ $found = "yes" ]]; then - echo "Starting post for fhr=$fhr" - - #################################### - # control the inclusion of perturbation identifiers - # in the GRIB1 ensemble PDS header extension - #################################### - - if [[ -s $pcfile ]]; then - nmissing=0 - check_files="$fileaout $fileaouti" - if [[ makepgrb2b == "yes" ]]; then - check_files="$check_files $filebout $filebouti" - fi - for file in $check_files ; do - if [[ ! -s $file ]]; then - echo "file=$file IS MISSING" - (( nmissing = nmissing + 1 )) - fi - done # for file in $fileaout $fileaouti $filebout $filebouti - if (( nmissing > 0 )) || [[ $RERUN == "YES" ]]; then - rm $pcfile - fi - else - nmissing=1 - fi # [[ -s $pcfile ]] - - if [[ ! -s $pcfile ]]; then - if (( hour == 0 )); then - parmlist_a=$parmlist_a00 - parmlist_b=$parmlist_b00 - else - parmlist_a=$parmlist_ahh - parmlist_b=$parmlist_bhh - fi - export parmlist_a - export parmlist_b - $USHgefs/gefs_prdgen.sh - - # Check for error - export err=$? - if [[ $err -ne 0 ]]; then - echo "FATAL ERROR in ${.sh.file} ($stream): Creation of product failed at f${fhr}!" - err_chk - exit $err - fi - - #################################### - # send control files to misc - #################################### - if [[ $SENDCOM = "YES" ]]; then - echo "$PDY$cyc$fhr" > $pcfile - fi - fi # [[ ! -s $pcfile ]] - - fi # [[ $found = "yes" ]] + export err=1; + err_chk + exit $err + fi # [ $ic -eq $SLEEP_LOOP_MAX ] + done # while [ $ic -le $SLEEP_LOOP_MAX ] + + if [[ $found = "yes" ]]; then + echo "Starting post for fhr=$fhr" + + #################################### + # control the inclusion of perturbation identifiers + # in the GRIB1 ensemble PDS header extension + #################################### + + if [[ -s $pcfile ]]; then + nmissing=0 + check_files="$fileaout $fileaouti" + if [[ makepgrb2b == "yes" ]]; then + check_files="$check_files $filebout $filebouti" + fi + for file in $check_files ; do + if [[ ! -s $file ]]; then + echo "file=$file IS MISSING" + (( nmissing = nmissing + 1 )) + fi + done # for file in $fileaout $fileaouti $filebout $filebouti + if (( nmissing > 0 )) || [[ $RERUN == "YES" ]]; then + rm $pcfile + fi + else + nmissing=1 + fi # [[ -s $pcfile ]] + + if [[ ! -s $pcfile ]]; then + if (( hour == 0 )); then + parmlist_a=$parmlist_a00 + parmlist_b=$parmlist_b00 + else + parmlist_a=$parmlist_ahh + parmlist_b=$parmlist_bhh + fi + export parmlist_a + export parmlist_b + $USHgefs/gefs_prdgen.sh + + # Check for error + export err=$? + if [[ $err -ne 0 ]]; then + echo "FATAL ERROR in ${.sh.file} ($stream): Creation of product failed at f${fhr}!" + err_chk + exit $err + fi + + #################################### + # send control files to misc + #################################### + if [[ $SENDCOM = "YES" ]]; then + echo "$PDY$cyc$fhr" > $pcfile + fi + fi # [[ ! -s $pcfile ]] + + fi # [[ $found = "yes" ]] done # for hour in $hours echo "$(date -u) end ${.sh.file}"