# --- 08/05/96 -------- EXRW1 SCRIPT ----------------------------
#
set +x
#  Document the HISTORY of script modifications
echo "REVISED: Monday  Aug  5,  1996  - standardize and  "
echo "                                - add SMS hooks"
echo "REVISED: TUESDAY June 3,  1997  - add execution for FNOC"
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"
echo "REVISED: TUESDAY June 20, 2001  - Removed execution for FNOC"
echo ""
echo "______________________________________________________"
echo "              IBM SP $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 " Revised: October 2008  - Marine stats will be computed "
echo " on the 1st and 16th of echo every month with a call to "
echo " marine_main_run_stats.sh                              "
echo " Revised: April 2013 - don't need to run AK counts on"
echo " the 16th of the month any longer, per AK PMOs."
echo "______________________________________________________"
set -xa
 
cd $DATA   

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

###############################################
# Create the weather depiction chart for afos only.
###############################################
$USHutil/exwxdep.sh $MAPHOUR

###############################################
#  Run exrdshpmpc.sh to dump marine data for OPC to quality control
#  note:  this script dumps data for 00Z, 06Z, 12Z, or 18Z synoptic period
#  +/- 3 hours from start of synoptic period.
###############################################
if test ${cyc} -ne '09' -a ${cyc} -ne '21'
then
   $USHutil/exrdshpmpc.sh $MAPHOUR
fi


###############################################
# This next program dumps RAOB data and produces alist of
# reporting stations and bulletin lengths.
# The SDM can view the results from SDM home dir, or from the
# shell script cardinal.list
###############################################
if test ${MAPHOUR} = '00' -o ${MAPHOUR} = '12'
then
   sh $USHutil/cardinal.sh $MAPHOUR
fi

##############################################
# archive surface marine data
###############################################

if test ${MAPHOUR} = '00' -o ${MAPHOUR} = '06' -o ${MAPHOUR} = '12' -o ${MAPHOUR} = '18'
then
   sh $USHutil/exdatarch.sh
   sh $USHutil/exarchqm.sh
fi

####################################################
# call the master script "marine_run_stats.sh"  at
# 12Z on 1st day of month.
####################################################

dayofmon=`echo $PDY | cut -c7-8`
if test ${MAPHOUR} = '12'
then
   if [ $dayofmon = '01' ] ; then
        sh $USHhrly/marine_main_run_stats.sh $dayofmon
   fi
fi

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

set +x
echo " ***** RW1 PROCESSING COMPLETED NORMALLY *****"
echo " ***** RW1 PROCESSING COMPLETED NORMALLY *****"
echo " ***** RW1 PROCESSING COMPLETED NORMALLY *****"
set -x
