#!/bin/sh

set +x
echo "********************************************************************"
echo "   Script Name: RUNradiosonde.sh                                    "
echo "   Contacts   : Bruce Whistler (bwhistler@nesdis.noaa.gov)          "
echo "                               (301-457-5258)                       "
echo "                Rich Kelley    (rkelley@nesdis.noaa.gov)            "
echo "                               (301-457-5195)                       "
echo "   Purpose    : Pull and Process bufr data from                     "
echo "                NCEP's model data directories after data is available"
echo "    MODIFIED FOR BLUE and WHITE.NCEP.NOAA.GOV  B. Whistler 12/03/04 "
echo "********************************************************************"
set -x
###########################################################################
# Script history log:
#
# 2006-03-17  P. O'Reilly       Added section to push data to DDS via DBNet
# 2006-09-13  P. O'Reilly	Removed all code associated with ftp to 
#				CEMSCS machine due to full transition to
#				NESDIS DDS.
# 2007-01-29  P. O'Reilly       Added gdas prepbufr files push to DDS.
#
###########################################################################
# Define Variables
#    Variables Exported
#       COM       - NCEP Model Data Directory
#       PDY       - Current YYYYMMDD
#       cyc       - Current Model Cycle (Numeric: 00)
#       cycle     - Current Model Cycle (Alpha-Numeric: t00z)
#       SCRATCHdir- Temporary Working Directory
#       EXECdir   - Executables Directory
#       PARMdir   - Parameter Files Directory
#       SCRIPTdir - Script Directory
#    Local Variables
#       ftplog - Prefix for data/index/out/tmp files
##################################################################

set +x
echo " "
echo "********************************************************************"
echo "        Radiosonde RUN has started at $(date)                       "
echo "********************************************************************"
echo " "
set -x

cd $DATA

################################################################
# Alert DBNet to send files to DDS
################################################################

if [ $SENDDBN = "YES" ] ; then
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE $job \
     $COMINm1/gdas1.t00z.adpupa.tm00.bufr_d
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE $job \
     $COMINm1/gdas1.t06z.adpupa.tm00.bufr_d
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE $job \
     $COMINm1/gdas1.t12z.adpupa.tm00.bufr_d
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE $job \
     $COMINm1/gdas1.t18z.adpupa.tm00.bufr_d
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE2 $job \
     $COMIN/gdas1.t00z.adpupa.tm00.bufr_d
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE2 $job \
     $COMIN/gdas1.t06z.adpupa.tm00.bufr_d

    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE3 $job \
     $COMINm1/gdas1.t12z.prepbufr.nr
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE3 $job \
     $COMINm1/gdas1.t18z.prepbufr.nr
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE4 $job \
     $COMIN/gdas1.t00z.prepbufr.nr
    $DBNROOT/bin/dbn_alert MODEL DDS_RSONDE4 $job \
     $COMIN/gdas1.t06z.prepbufr.nr
fi

set +x
echo " "
echo "********************************************************************"
echo "        $model ${cyc}Z RUN has ended at $(date)                     "
echo "********************************************************************"
echo " "
set -x
