
#  UTILITY SCRIPT NAME :  dfwindsx.sh
#               AUTHOR :  Hua-Lu pan
#         DATE WRITTEN :  11/26/96
#
#  Abstract:  This utility script produces the dfwindsx
#             bulletins, from the GFS forecast fields
#
#     Input:  none
#             This job requires the presence of the 65x65 GRIB file
#               for hours 12 18 and 24
#
echo "History: SEPT    1996 - First implementation of this utility script"
#

set -xa

export pgm=dfwindsv
. prep_step

cp $COMIN/${RUN}.${cycle}.grb65f12 GRB65F12
cp $COMIN/${RUN}.${cycle}.grb65f18 GRB65F18
cp $COMIN/${RUN}.${cycle}.grb65f24 GRB65F24
cp $COMIN/${RUN}.${cycle}.grb65if12 GRB65iF12
cp $COMIN/${RUN}.${cycle}.grb65if18 GRB65iF18
cp $COMIN/${RUN}.${cycle}.grb65if24 GRB65iF24
  
cp $PARMbulls/bulls_dfstns.gfs dfstns

export XLFUNIT_11="GRB65F12"
export XLFUNIT_12="GRB65F18"
export XLFUNIT_13="GRB65F24"
export XLFUNIT_31="GRB65iF12"
export XLFUNIT_32="GRB65iF18"
export XLFUNIT_33="GRB65iF24"
export XLFUNIT_51="dfwind.bul"

startmsg
$EXECbulls/dfwindsx < dfstns >> $pgmout 2>errfile 
export err=$?; err_chk

if test "$err" = 0
then
  msg="dfwind successfully made"
  postmsg "$jlogfile" "$msg"
else
  msg="dfwind failed "
  postmsg "$jlogfile" "$msg"
fi

############################################
#  Send bulletin through dbNet
############################################

if test "$SENDCOM" = 'YES'
then
  cp dfwind.bul $pcom/dfwind.bul.$job

  if test "$SENDDBN" = 'YES'
  then
    $USHutil/make_ntc_bull.pl  WMOBH NONE KWNO NONE    \
         dfwind.bul    $pcom/dfwind.bul.$job
    err=$?;export err

    if test "$err" = 0
    then
      msg="dfwind dbnet alert successfully done"
      postmsg "$jlogfile" "$msg"
    else
      msg="dfwind dbnet alert failed "
      postmsg "$jlogfile" "$msg"
    fi
  fi
fi

exit
