#!/bin/sh
# --- 02/07/97 ---------- EXSURGE SCRIPT --------------------------
#
set +x
echo " ---------------------------------------------------------"
echo "  "
echo "                   STORM SURGE"
echo "  "
echo "  "
echo "                   JOB gfs_stormsurge "
echo "  "
echo "          ANALYSIS CYCLE TIME IS .. $CYCLE"
echo "  "
echo "  "
echo "  "
echo " ---------------------------------------------------------"
echo "        processing info for this execution      "
echo "Processing environment is .............. ${envir}"
echo "Temporary processing file directory is . $DATA"
echo "  "
echo "Executable SURGE directory is .......... $EXECmdl"
echo "Unix Control Language directory is ..... $PARMmdl"
echo "FIX-field directory is ................. $FIXmdl"
echo "  "
echo "Network id is .......................... $NET"
echo "Run id for com files is ................ $RUN"
echo "  "
echo "Unique machine processing id is ........ $pid"
echo "Temporary Output file is ............... $pgmout"
echo "YES SENDDBN means post messages ........ $SENDDBN"
echo "YES SENDCOM means save com files ....... $SENDCOM"
echo " "
echo " ---------------------------------------------------------"
echo " ---------------------------------------------------------"
   # "HISTORY: Oct 03, 1995 - implement Storm Surge"
   # "HISTORY: Feb 07, 1996 - added qsub to ftp the UCL files"
   # "         from the machine in which it ran to the other"
   # "         two Crays."
   # "         Linked the gribex executable in here file exapplywnd,"
   # "         to a more discriptive word to aid in monitoring"
   # "         We no longer save the old cylf10'${bsn}' file to the"
   # "         com files, it is saved only to $PARMmdl dir."
   # "         In here file output_hds, place directions to submit"
   # "         the file to the front end in case of an ftp failure"
   # "         In here file output_com, took off the .new from"
   # "         file ss.${CYCLE}.cylf10'${bsn}' Also, the file"
   # "         ss.gribi${CYL} has '${bsn}' appended on it."
   # "         In here file SENDBULLETIN, added a test for the ftp"
   # "         transfer of the jcl to the HDS."
   # "HISTORY: 03/19/96 - Major script changes."
   # "         01/28/97 - Script changes to use the Cray version"
   # "         of FORMBULL to generate the FQUS23, the FQAC40,"
   # "         and the FQGX40 messages which contain the extra-"
   # "         tropical storm surge forecasts for the Atlantic"
   # "         Coast, the Bering Sea, and the Gulf of Mexico,"
   # "         respectively"
   # "         02/07/97 - Removed as many references to HDS as possible"
   # "                    operator messages can still be disposed to HDS"
   # "         04/30/97 - Added qsub to kick off MDL owned job."
   # "         08/26/98 - Data is no longer stored in /nwprod/mdl/parm."
   # "                    Instead it will be in /com/gfs/prod/gfs.YYMMDD."
   # "         09/02/98 - Modified by Peter Henrichsen to use script"
   # "                    onebul.sh to make and send storm surge"
   # "                    bulletins."
   # "         03/08/00 - Modified by Steve Gilbert to run on IBM SP"
   # "         09/25/00 - Added West Coast and Arctic basins.       "
   # "         11/28/00 - Modified by Peter Henrichsen to replace"
   # "                    onebul.sh with perl script formbul.pl"
   # "         06/12/02 - Added dbnet alerts to get files to TGFTP"
   # "         09/01/01 - Model changes using all 4 cycles of GFS's"
   # "         analyses. Do without rotating the analysis files. J. Chen"
   # "         08/16/02 - Combined J.Chen's version with operational script"
   # "         10/16/05 - Modified to send text bulletins to TOC via the   "
   # "         10/16/05 - NTC rather than the status file.                 "
   # " ---------------------------------------------------------"

function copyreq {
  cp $1 $2
  if [ $? -ne 0 ]; then
    msg="FATAL ERROR: $1 is missing."
    postmsg "$jlogfile" "$msg"
    errexit
  fi
}

set -x
export RANK=$MP_CHILD
echo "`date`: Starting rank ${RANK}" >> timing.txt

######################################################################
#  Prepare data before running program to extract current and
#    forecast (future) global surface pressure, and U and V wind
#    vector fields.
######################################################################
if [[ ${RANK} == 0 ]] ; then

  ## msg="Begin job for $job"
  ## postmsg "$jlogfile" "$msg"

  for i in $(seq -f "%02g" 0 3 96); do
    copyreq  $COMIN/${NET}.${cycle}.pgrb2f$i  pgrb2f$i
  done

  echo "`date`: Rank ${RANK} finished copying in input data" >> timing.txt

  ######################################################################
  #  Run program to extract current and forecast (future) global
  #    surface pressure, and U and V wind vector fields.
  ######################################################################
  export pgm="mdl_cy_puv10"
  . prep_step

  export FORT11=pgrb2f00
  export FORT12=pgrb2f03
  export FORT13=pgrb2f06
  export FORT14=pgrb2f09
  export FORT15=pgrb2f12
  export FORT16=pgrb2f15
  export FORT17=pgrb2f18
  export FORT18=pgrb2f21
  export FORT19=pgrb2f24
  export FORT20=pgrb2f27
  export FORT21=pgrb2f30
  export FORT22=pgrb2f33
  export FORT23=pgrb2f36
  export FORT24=pgrb2f39
  export FORT25=pgrb2f42
  export FORT26=pgrb2f45
  export FORT27=pgrb2f48
  export FORT28=pgrb2f51
  export FORT29=pgrb2f54
  export FORT30=pgrb2f57
  export FORT31=pgrb2f60
  export FORT32=pgrb2f63
  export FORT33=pgrb2f66
  export FORT34=pgrb2f69
  export FORT35=pgrb2f72
  export FORT36=pgrb2f75
  export FORT37=pgrb2f78
  export FORT38=pgrb2f81
  export FORT39=pgrb2f84
  export FORT40=pgrb2f87
  export FORT41=pgrb2f90
  export FORT42=pgrb2f93
  export FORT43=pgrb2f96

  export FORT81=gfsp.tmp
  export FORT82=gfsu.tmp
  export FORT83=gfsv.tmp

  export FORT84=$PARMmdl/mdl_ft11.egawz
  export FORT85=gfspuv.${cyc}e
  export FORT86=gfspuv.${cyc}g
  export FORT87=gfspuv.${cyc}a
  export FORT88=gfspuv.${cyc}w
  export FORT89=gfspuv.${cyc}z
  export FORT90=gfspuv.${cyc}k
  # export FORT91=gfspuv.${cyc}m
  export FORT96=sds.${cyc}

  startmsg
  $EXECmdl/mdl_cy_puv10 >>$pgmout 2>errfile
  export err=$?; err_chk

  ######################################################################
  #  Save extracted current and forecast (future) global surface
  #    pressure, and U and V wind vector fields for each basin.
  #  This is so that one can re-run the model in the future.
  ######################################################################
  # Moved this to the post prcessing step per basin.
  # That way rank 1 is not waiting as long.
  #if test "$SENDCOM" = 'YES'
  #then
  #  cp gfspuv.${cyc}e $COMOUT
  #  cp gfspuv.${cyc}g $COMOUT
  #  cp gfspuv.${cyc}a $COMOUT
  #  cp gfspuv.${cyc}w $COMOUT
  #  cp gfspuv.${cyc}z $COMOUT
  #  cp gfspuv.${cyc}k $COMOUT
  #fi

  echo "`date`: Rank ${RANK} finished with forecast winds" >> timing.txt
  echo "Finished creating FcstWinds" >> msg_FcstWinds.txt

elif [[ ${RANK} == 1 ]] ; then

######################################################################
#  Prepare data before running program to extract Past (historic)
#    global surface pressure, and U and V wind vector fields.
#  Needs 60 hours back...
#    (ie cycle 0Z day 0 needs back to cycle 12Z day -3)
#  Use PDYm1,PDYm2.... for -1 day, -2 day ...
#  The reason this is so long is to keep it simple.
######################################################################

  CYCLE1='t00z'
  CYCLE2='t06z'
  CYCLE3='t12z'
  CYCLE4='t18z'

  # Files needed by all cycles (0,6,12,18)...
  #     6Z of -2 day to 18Z of -1 day
  copyreq  $COMINm2/${NET}.$CYCLE2.pgrb2f00  pgrb2f206
  copyreq  $COMINm2/${NET}.$CYCLE3.pgrb2f00  pgrb2f212
  copyreq  $COMINm2/${NET}.$CYCLE4.pgrb2f00  pgrb2f218
  copyreq  $COMINm1/${NET}.$CYCLE1.pgrb2f00  pgrb2f100
  copyreq  $COMINm1/${NET}.$CYCLE2.pgrb2f00  pgrb2f106
  copyreq  $COMINm1/${NET}.$CYCLE3.pgrb2f00  pgrb2f112
  copyreq  $COMINm1/${NET}.$CYCLE4.pgrb2f00  pgrb2f118

  case "$cyc" in
  00)
    # Cycle 0 needs 12Z 18Z of -3 day and 0Z of -2 day
    copyreq  $COMINm3/${NET}.$CYCLE3.pgrb2f00  pgrb2f312
    copyreq  $COMINm3/${NET}.$CYCLE4.pgrb2f00  pgrb2f318
    copyreq  $COMINm2/${NET}.$CYCLE1.pgrb2f00  pgrb2f200
    ;;
  06)
    # Cycle 6 needs 18Z of -3 day and 0Z of -2 day
    copyreq  $COMINm3/${NET}.$CYCLE4.pgrb2f00  pgrb2f318
    copyreq  $COMINm2/${NET}.$CYCLE1.pgrb2f00  pgrb2f200
    # Cycle 6 needs 0Z of current day
    copyreq  $COMIN/${NET}.$CYCLE1.pgrb2f00  pgrb2f000
    ;;
  12)
    # Cycle 12 needs 0Z of -2 day
    copyreq  $COMINm2/${NET}.$CYCLE1.pgrb2f00  pgrb2f200
    # Cycle 12 needs 0Z 6Z of current day
    copyreq  $COMIN/${NET}.$CYCLE1.pgrb2f00  pgrb2f000
    copyreq  $COMIN/${NET}.$CYCLE2.pgrb2f00  pgrb2f006
    ;;
  18)
    # Cycle 18 needs 0Z 6Z 12Z of current day
    copyreq  $COMIN/${NET}.$CYCLE1.pgrb2f00  pgrb2f000
    copyreq  $COMIN/${NET}.$CYCLE2.pgrb2f00  pgrb2f006
    copyreq  $COMIN/${NET}.$CYCLE3.pgrb2f00  pgrb2f012
    ;;
  esac

  echo "`date`: Rank ${RANK} finished copying in input data" >> timing.txt

  ######################################################################
  #  Run program to extract Past (historic) global surface pressure,
  #    and U and V wind vector fields.
  ######################################################################
  export pgm="mdl_c10_gen"
  . prep_step

  case "$cyc" in
  00)  # 00Z cycle
    export FORT11=pgrb2f312
    export FORT12=pgrb2f318
    export FORT13=pgrb2f200
    export FORT14=pgrb2f206
    export FORT15=pgrb2f212
    export FORT16=pgrb2f218
    export FORT17=pgrb2f100
    export FORT18=pgrb2f106
    export FORT19=pgrb2f112
    export FORT20=pgrb2f118
    ;;
  06)  # 06Z cycle
    export FORT11=pgrb2f318
    export FORT12=pgrb2f200
    export FORT13=pgrb2f206
    export FORT14=pgrb2f212
    export FORT15=pgrb2f218
    export FORT16=pgrb2f100
    export FORT17=pgrb2f106
    export FORT18=pgrb2f112
    export FORT19=pgrb2f118
    export FORT20=pgrb2f000
    ;;
  12)  # 12Z cycle
    export FORT11=pgrb2f200
    export FORT12=pgrb2f206
    export FORT13=pgrb2f212
    export FORT14=pgrb2f218
    export FORT15=pgrb2f100
    export FORT16=pgrb2f106
    export FORT17=pgrb2f112
    export FORT18=pgrb2f118
    export FORT19=pgrb2f000
    export FORT20=pgrb2f006
    ;;
  18)  # 18z cycle
    export FORT11=pgrb2f206
    export FORT12=pgrb2f212
    export FORT13=pgrb2f218
    export FORT14=pgrb2f100
    export FORT15=pgrb2f106
    export FORT16=pgrb2f112
    export FORT17=pgrb2f118
    export FORT18=pgrb2f000
    export FORT19=pgrb2f006
    export FORT20=pgrb2f012
    ;;
  esac

  export FORT30=$PARMmdl/mdl_ft11.egawz
  export FORT51=cylf10.${cyc}e
  export FORT52=cylf10.${cyc}g
  export FORT53=cylf10.${cyc}a
  export FORT54=cylf10.${cyc}w
  export FORT55=cylf10.${cyc}z
  export FORT56=cylf10.${cyc}k
  # export FORT57=cylf10.${cyc}m
  export FORT96=sds.${cyc}
  export FORT81=cylp.tmp
  export FORT82=cylu.tmp
  export FORT83=cylv.tmp

  startmsg
  $EXECmdl/mdl_c10_gen >>$pgmout 2>errfile
  export err=$?;err_chk
  echo "`date`: Rank ${RANK} finished with Hind Cast winds." >> timing.txt
  echo "Finished creating Hind Cast Winds" >> msg_HindWinds.txt
 
fi ; # End of the Rank 0, Rank 1 prep step

######################################################################
# There are 6 basins for which forecasts are made.
#   1) e = East Coast Basin  (FQUS23 KWNO, MRP SSE)
#   2) g = Gulf Coast Basin  (FQGX23 KWNO, MRP SSG)
#   3) a = Alaska Basin      (FQAK23 KWNO, MRP SSB)
#   4) w = West Coast Basin  (FQPZ23 KWNO, MRP SSP)
#   5) z = Artic Basin       (FQAC23 KWNO, MRP SSA)
#   6) k = Gulf of AK        (FQGA23 KWNO, MRP SSC)
######################################################################

## for bsn in e g a w z k
## do
##  ####################################################################
##  #  Run extratropical storm surge model.
##  ####################################################################
##  export pgm="mdl_ext_6h"
##  . prep_step
##
##  export FORT96=sds.${cyc}
##  export FORT11=$PARMmdl/mdl_ft11.${bsn}
##  export FORT14=$PARMmdl/mdl_ettgp.${bsn}
##  export FORT19=$PARMmdl/mdl_etbsn.${bsn}
##  export FORT21=$PARMmdl/mdl_ft01.ega
##  export FORT25=$PARMmdl/mdl_etltlg.${bsn}
##  export FORT33=cylf10.${cyc}${bsn}
##  export FORT34=gfspuv.${cyc}${bsn}
##  export FORT81=fle10.tmp
##  export FORT82=fle20.tmp
##  export FORT83=fle30.tmp
##  export FORT84=fle40.tmp
##  export FORT85=fle50.tmp
##  export FORT86=fle60.tmp
##  export FORT52=sshistory.${cyc}${bsn}
##  export FORT53=ssgrid.${cyc}${bsn}
##
##  startmsg
##  $EXECmdl/mdl_ext_6h >>$pgmout 2>errfile
##  err=$?;export err; err_chk
##  echo "`date`: Finished Run for ${bsn}" >> timing.txt
## done      #  Basin loop

while [[ ! -f msg_HindWinds.txt || ! -f msg_FcstWinds.txt ]] ; do
  echo "`date`: Rank ${RANK} sleeping." >> timing.txt
  sleep 1
done
  
echo "`date`: Rank ${RANK} starting model runs." >> timing.txt

if [[ ${RANK} == 0 ]] ; then
  # Assign ConUS region to Rank 0
  ${USHmdl}/gfs_stormsurge_poe.sh other ${cyc} ${PARMmdl} ${EXECmdl}
  echo "Model East/West/Ak complete" > msg_EastWestAKDone.txt
  rgnList="e g w"
  area="con"
  gridres="2.5km"
elif [[ ${RANK} == 1 ]] ; then
  # Assign Alaska region to Rank 1
  ${USHmdl}/gfs_stormsurge_poe.sh g ${cyc} ${PARMmdl} ${EXECmdl}
  echo "Model Gulf complete" > msg_GulfDone.txt
  rgnList="a z k"
  area="ala"
  gridres="3km"
fi

# Reason to assign a z k and ala to Rank 1 is that they appear easier
# and Rank 1 is likely to be in sleep mode and will need a sec to wake up.
# Rank 1 is likely in sleep mode because g is easier.
# However this does mean both model runs need to be complete since
# Rank 1 depends entirely on Rank 0 regions, and Rank 0 depends on Rank
# 1's Gulf of Mexico

while [[ ! -f msg_EastWestAKDone.txt || ! -f msg_GulfDone.txt ]] ; do
  echo "`date`: Rank ${RANK} sleeping." >> timing.txt
  sleep 1
done

###################################################################
#  Post process the basin runs.
####################################################################
for bsn in ${rgnList}
do
  ####################################################################
  #  Run program to extract storm surge output.
  ####################################################################
  export pgm="mdl_mdlsurge"
  . prep_step

  export FORT11=$PARMmdl/mdl_ft11.${bsn}
  export FORT16=gfspuv.${cyc}${bsn}
  export FORT17=sshistory.${cyc}${bsn}
  export FORT58=mdlsurge.${cyc}${bsn}
  export FORT96=sds.${cyc}

  startmsg
  $EXECmdl/mdl_mdlsurge >>$pgmout 2>errfile
  export err=$?; err_chk
  echo "`date`: Finished extracting text answers for ${bsn}" >> timing.txt

  ####################################################################
  #  Save model output files (and some input files),  so that one can
  #    re-run the model in the future.
  ####################################################################

  if test "$SENDCOM" = 'YES'
  then
    cp mdlsurge.${cyc}${bsn} $COMOUT/mdlsurge.${cyc}${bsn}
    cp sshistory.${cyc}${bsn} $COMOUT/sshistory.${cyc}${bsn}
    cp $DATA/sds.${cyc} $COMOUT/sds.${cyc}
    cp $DATA/cylf10.${cyc}${bsn} $COMOUT/cylf10.${cyc}${bsn}
    cp $DATA/gfspuv.${cyc}${bsn} $COMOUT/gfspuv.${cyc}${bsn}
  fi

  ####################################################################
  #  Send text messages to NWS FTP server.
  ####################################################################

  if test "$SENDDBN" = 'YES'
  then
    $DBNROOT/bin/dbn_alert MDLFCST ETSSTXT$DBN_ALERT_SUFFIX $job $COMOUT/mdlsurge.${cyc}${bsn}
  fi

  #
  # create the extratropical storm surge bulletins by using NCEP's
  # form_ntc.pl software to make the bulletins.
  #

  case $bsn in
    e)  name="fqus23";;
    g)  name="fqgx23";;
    a)  name="fqak23";;
    w)  name="fqpz23";;
    z)  name="fqac23";;
    k)  name="fqga23";;
    *)  echo "Basin $bsn not recognized"; errexit;;
  esac

  $utilscript/form_ntc.pl -d $name -f mdlsurge.${cyc}${bsn} \
    -j $job -m $NET -p $pcom -s $SENDDBN_PCOM -o ${name}.tran.$job

  echo "`date`: Finished transmitting text answers for ${bsn}" >> timing.txt

done      #  Basin loop

#####################################################################
# Merge the results onto NDFD Conus (con) and Alaska (ala) grids.
# This is a copy of what is in "gridmerge.sh.sms"
#####################################################################
## for area in con ala
## do
  ####################################################################
  #  Run gridmerge program
  ####################################################################
  export pgm="gridmerge"
  . prep_step

  ##########set up date info... PDY is today, PDYm1 one day ago... etc.
  echo $PDY $cyc > $DATA/datetime.${area}.txt
  export FORT17=$DATA/datetime.${area}.txt
  ##########write area and cycle into control file
  echo $area $cyc > $DATA/control.${area}.txt
  export FORT11=$DATA/control.${area}.txt
  
  export FORT12=$PARMmdl/mdl_etgrids.${area}
  if test "$area" = 'con'
  then
    export FORT13=ssgrid.${cyc}e
    export FORT14=ssgrid.${cyc}g
    export FORT15=ssgrid.${cyc}w
  elif test "$area" = 'ala'
  then
    export FORT13=ssgrid.${cyc}a
    export FORT14=ssgrid.${cyc}z
    export FORT15=ssgrid.${cyc}k
  fi

  if test "$area" = 'con'; then
    export FORT16=$PARMmdl/mdl_etconus.bin
  elif test "$area" = 'ala'; then
    export FORT16=$PARMmdl/mdl_etalaska.bin
  fi
  export FORT18=mdlsurge_map.${gridres}.${cyc}${area}
  export FORT53=mdlsurgegrid.${gridres}.${cyc}${area}

  startmsg
  $EXECmdl/mdl_gridmerge_2.5km
  export err=$?; err_chk
  echo "`date`: Finished creating GRIB message for new grid ${area}" >> timing.txt

  if test "$area" = 'con'; then
    export FORT16=$PARMmdl/mask_conus_5km.bin
  elif test "$area" = 'ala'; then
    export FORT16=$PARMmdl/mask_alaska_6km.bin
  fi
  export FORT18=mdlsurge_map.${cyc}${area}
  export FORT53=mdlsurgegrid.${cyc}${area}

  startmsg
  $EXECmdl/mdl_gridmerge
  export err=$?; err_chk
  echo "`date`: Finished creating GRIB message for old grid ${area}" >> timing.txt

  #################################
  # Add headers to old output grids
  #################################
  export pgm=tocgrib2 
  . prep_step
  # export XLFRTEOPTS="unit_vars=yes"
  export FORT11=mdlsurgegrid.${cyc}${area}
  export FORT31=""
  export FORT51=grib2.mdlsurgegrid.${cyc}${area}

  startmsg
  ${utilexec}/tocgrib2 < $PARMmdl/grib2.t${cyc}z.mdl_etsurge_${area}  >> $pgmout 2> errfile
  export err=$?; err_chk

  ####################################################################
  # Add WMO super header and new individual header to new output grids
  ####################################################################

  echo 0 > filesize
  export FORT11=mdlsurgegrid.${gridres}.${cyc}${area}
  export FORT12=filesize 
  export FORT31="" 
  export FORT51=grib2.mdlsurgegrid.${gridres}.${cyc}${area}.temp

  startmsg
  ${utilexec}/tocgrib2super < $PARMmdl/grib2.t${cyc}z.mdl_etsurge_${area}_new  >> $pgmout 2> errfile
  export err=$?; err_chk

  echo `ls -l grib2.mdlsurgegrid.${gridres}.${cyc}${area}.temp | awk '{print $5}'` > filesize
  export FORT11=grib2.mdlsurgegrid.${gridres}.${cyc}${area}.temp
  export FORT12=filesize
  export FORT31=""
  export FORT51=grib2.mdlsurgegrid.${gridres}.${cyc}${area}

  startmsg
  ${utilexec}/tocgrib2super < $PARMmdl/grib2.t${cyc}z.mdl_etsurge_${area}_new  >> $pgmout 2> errfile
  export err=$?; err_chk

  ##############################################
  # Save output (mdlsurgegrid.$cyc$area used to rerun model)
  ##############################################
  if [ $SENDCOM = YES ]
  then
     cp mdlsurgegrid.*${cyc}${area} $COMOUT/
     cp grib2.mdlsurgegrid.*${cyc}${area} $COMOUT/
  fi

  ################################################
  # Alert the file (WOC SBN)
  ################################################
  cp grib2.mdlsurgegrid.${cyc}${area} $pcom/grib2.mdlsurgegrid.${cyc}${area}.${job}
  cp grib2.mdlsurgegrid.${gridres}.${cyc}${area} $pcom/grib2.mdlsurgegrid.${gridres}.${cyc}${area}.${job}
  if [ $SENDDBN_PCOM = YES ]
  then
    $DBNROOT/bin/dbn_alert NTC_LOW gfs $job $pcom/grib2.mdlsurgegrid.${cyc}${area}.${job}
    $DBNROOT/bin/dbn_alert NTC_LOW gfs $job $pcom/grib2.mdlsurgegrid.${gridres}.${cyc}${area}.${job}
  fi

  ################################################
  # Alert the file (WOC ftp)
  ################################################
  if test "$SENDDBN" = 'YES'
  then
    $DBNROOT/bin/dbn_alert MDLFCST ETSSGB2$DBN_ALERT_SUFFIX $job $COMOUT/grib2.mdlsurgegrid.${cyc}${area}
    $DBNROOT/bin/dbn_alert MDLFCST ETSSGB2$DBN_ALERT_SUFFIX $job $COMOUT/grib2.mdlsurgegrid.${gridres}.${cyc}${area}
  fi
  echo "`date`: Finished putting header in for GRIB message for ${area}" >> timing.txt
### done

#####################################################################
# GOOD RUN
set +x
echo "**************JOB gfs_stormsurge COMPLETED NORMALLY"
echo "**************JOB gfs_stormsurge COMPLETED NORMALLY"
echo "**************JOB gfs_stormsurge COMPLETED NORMALLY"
set -x
#####################################################################

# cat $pgmout
echo "`date`: Rank ${RANK} finished." >> timing.txt

############## END OF SCRIPT #######################
