#! /bin/sh
set -xa

# Dump metar data for MADIS
#
# This script's Variables
#   CDY  (imported)  Current day (like PDY but not based on com/date)
#   HHMM (imported)  Current time
#   RUNDIR     the RSAS Run directory
#   ATIME      the MAPS 9-character DB time (YYDDDHHMM)
#

RUNDIR=$DATA/sfc/iqc1

mkdir -p $COMOUT/metar/bufr $RUNDIR

HH=${HHMM:0:2}
CTIME=`date -d "$CDY $HH:00:00 UTC" +%y%j%H00`
CTIMEM1H=`date -d "$CDY $HH:00:00 UTC -1 hour" +%y%j%H00`
for ATIME in ${CTIMEM1H} ${CTIME}; do 
    
    $USHmadis/FSL_qcstg1_2.run $RUNDIR $ATIME
    export err=$?;err_chk

done
