#! /bin/ksh

##############################################################
# exnesdis_dumpbuoy_goessst.sh.sms
##############################################################
# NESDIS POC for this script is:
#  Bob Potash 
#  email: Bos.Potash@noaa.gov
##############################################################
# History:
#  10-05-2005 -- Convert to IBM CCS production
#
##############################################################

set -x

cd $DATA

##############################################################
# Dump GOES SST DATA using the universal dumpjb script
##############################################################

export hour=$cyc

export DUMP=/nwprod/ush/dumpjb
export LOUD=on
export RADIUS=00.5

echo "$DUMP ${PDY}${cyc}.00 $RADIUS 001 002 003"
time $DUMP ${PDY}${cyc}.00 $RADIUS 001 002 003

export err=$?
if [ $err -ne 0 ]
then
  echo "Data dump failed for GOES SST data"
  err_chk
fi

##############################################################
# Extract the GOEST SST data from the bufr file
##############################################################
export pgm=nesdis_extract_goessst
. prep_step

export XLFUNIT_10="001.ibm"
export XLFUNIT_51="buoysst.ascii_$hour"

$EXECnesdis/nesdis_extract_goessst>>$pgmout 2> errfile
err=$?; err_chk

if [ $SENDCOM = "YES" ]
then
   cp buoysst.ascii_$hour $COMOUT/.
fi

if [ $SENDDBN = YES ]
then
    $DBNROOT/bin/dbn_alert MODEL BUOY_SST $job $COMOUT/buoysst.ascii_$hour 
fi

msg="JOB $job HAS COMPLETED NORMALLY."
postmsg "$jlogfile" "$msg"
