#! /bin/csh -f

if ($#argv < 4) then
echo " "
echo "need at least FOUR arguments"
echo " "
echo "first is model cycle time"
echo " "
echo "second is length of Eta model run to be made"
echo " "
echo "third is the time interval between input files (typically 3 or 6)"
echo " "
echo "fourth is grid type (104,212,221,tile,avn,wafs,ecmwf)"
echo " "
echo "fifth is the filename of the ECO file"
echo "it is only applicable when ECMWF data are used"
echo " "
echo "sixth is the start date of the model run"
echo "it is only applicable when ECMWF data are used"
echo " "
echo "****>>> if using NCEP reanalysis data, should not <<<****"
echo "****>>> be using this script                      <<<****"
echo " "
echo " "
echo " "
exit
endif

#dule get_data.scr $1 $2 $3 $4

./process_grib.scr $1 $2 $3 $4 $5 $6

if ($4 == wafs) then

cd ../../data/prep

echo "grabbing sfcanl file"
set today=`date +%Y%m%d`

echo $today

ftp -in ftpprd.ncep.noaa.gov << endftp1
user anonymous `whoami`@
binary
cd /pub/data/nccf/com/avn/prod/avn.$today/
get gblav.t${1}z.sfcanl sfcanl.${today}.${1}
endftp1

cp sfcanl.${today}.${1} ../../eta/bin/sfcanl

endif
