# --- 08/05/96 -------- EXRW2 SCRIPT ----------------------------
#
set +x
echo  " Document the HISTORY of script modifications "
echo  "REVISED: Monday  Aug  5,  1996  - standardize and  "
echo  "                                - add SMS hooks"
echo  "REVISED: Wed.,   Jan 28,  1998  - adding call to "
echo  "                                - exafossta.sh which "
echo  "                                - makes 4 AFOS charts"
echo  "REVISED: 30 July 1998 - Removed definition of PDY, this is"
echo  "                        now done in the J-job."
echo  "REVISED: Friday  Feb. 12, 1999  - add call to util script"
echo  "                                  exrdshpmpc which dumps"
echo  "                                  marine data for MPC to QC"
set -x
 
cd $DATA
 
set +x
echo '------------------------------------------------------'
echo "              IBM $envir PROCESSING                "
echo "      `date`      "
echo "     JOB WWRW2$HOUR   CYCLE TIME IS  ... $CYCLE"
echo ' '
echo ' $VARIABLE info for this execution:'
echo " Processing executable environment is ............ $envir"
echo " Temporary processing file directory is .......... $DATA"
echo " unique machine processing id is ................. $pid"
echo "________________________________________________"
set -xa
 
# mod the cycle time by 6
MOD6=`expr $MAPHOUR % 6`

# mod the cycle time by 12
MOD12=`expr $MAPHOUR % 12`

###########################################
# Run exrwdump.sh to dump synoptic,metar,ships,dbuoy,mbuoy, and lcman data.
###########################################
$USHutil/exrwdump.sh $MAPHOUR

if [ $MOD12 -eq 0 ]
then

   ###########################################
   # generate max/min temperatures
   ###########################################
   $USHutil/expltpgm1.sh $MAPHOUR 

   ###########################################
   #  Run exrdshpmpc.sh to dump marine data for MPC to quality control
   #  note:  this script dumps data for 00Z, 06Z, 12Z, or 18Z synoptic period
   #  +/- 3 hours from start of synoptic period.
   ###########################################
   $USHutil/exrdshpmpc.sh $MAPHOUR

fi

if [ $MOD6 -eq 0 ]
then

   ###########################################
   # generate precip and snow plot file
   ###########################################
   $USHutil/expltpgm2.sh $MAPHOUR

   ###########################################
   # generate SSVD50 KWBC bulletin
   ###########################################
   $USHutil/exarbuoy.sh $MAPHOUR

fi

###########################################
# generate surface geostrophic wind components and vorticity.
###########################################
$USHutil/exgeofielv.sh $MAPHOUR

 
###########################################
# This next program dumps RAOB data and produces alist of 
# reporting stations and bulletin lengths.
# The SDM can view the results from /home/sd33sm, or from the 
# shell script cardinal.list
###########################################
if [ $MOD12 -eq 0 ]
then
  sh $USHutil/cardinal.sh $MAPHOUR
fi

###########################################
# generate AFOS chart P0N, P0P, and P0S at 12Z, and
# generate AFOS chart P0X at 00Z.
###########################################

if [ $MOD12 -eq 0 ]
then
  $USHutil/exafossta.sh $MAPHOUR
fi

###########################################
msg='JOB COMPLETED NORMALLY'
postmsg "$jlogfile" "$msg"
###########################################

set +x
echo " ***** RW2 PROCESSING COMPLETED NORMALLY *****"
echo " ***** RW2 PROCESSING COMPLETED NORMALLY *****"
echo " ***** RW2 PROCESSING COMPLETED NORMALLY *****"
set -x
# ---------------END OF EXRW2 SCRIPT ----------------------------
