#! /bin/sh
set -xa

# Dump satwind 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 MADIS Run directory
#   ATIME      the 9-character current time (YYDDDHHMM)
#
#   RAWDIR     the path to the output directory
#   

RUNDIR=${DATA}

RAWDIR=${COMOUT}/satw

mkdir -p $RAWDIR

HH=${HHMM:0:2}
MIN=${HHMM:2:2}
ATIME=`date -d "$CDY $HH:$MIN UTC" +%y%j%H%M`

############################################################################### 
# Run dump for 1 hour products
###############################################################################
echo "running 1 hr FSL_satw.run\n"
${USHmadis}/FSL_satw.run $RUNDIR 1 $ATIME $RAWDIR
export err=$?;err_chk

############################################################################### 
# Run dump for 3 hour products
###############################################################################
echo "running 3 hr FSL_satw.run\n"
${USHmadis}/FSL_satw.run $RUNDIR 3 $ATIME $RAWDIR
export err=$?;err_chk
