set -x 
 
#  Kitzmiller  MDL  Nov 2001   IBM AIX
 
#  Script for obtaining latest CH4 IR GOES-E and GOES-W
#  AREA-format files (CH4) from /dcom directory, dumping
#  navigation and temperature data to binary files, and 
#  interpolating temperatures to 10-km RCM radar mosaic grid.

#  Input files:

#  /dcom/us007003/yyyymmdd/satellite_ir_images/GE_NorthAm_4km
#  /dcom/us007003/yyyymmdd/satellite_ir_images/GW_NorthHem_4km
#  /dcom/us007003/yyyymmdd/satellite_ir_images/GW_Fulldisk_4km
#  sat_analyses_exp.ctl

#  Output file: ch4_rcm_latest (name set in .ctl file above)

#  *** NOTE 1: a version of the McIDAS binary dump command
#  axform.k must be available.  Any copy created under IBM
#  IBM AIX appears to work on any IBM AIX platform.

#  NOTE 2:  It is possible to speed up this script by
#  using a fixed set of navigation files *.LAT and *.LON
#  created by a previous invocation of axform.  In that
#  case the option "NAV=YES" shoud be removed from the axform
#  command lines and the files *.LAT and *.LON would not
#  be removed at the end of the command stream.


#  Copy fixed-name satellite files (updated automatically) to
#  McIDAS-convention names, necessary for axform command

export sdir="${DCOM}/${daystring}/satellite_ir_images"
echo "Current satellite directory: " $sdir

cp $sdir/GE_NorthAm_4km AREA0496
cp $sdir/GW_NorthHem_4km AREA0495
#cp $sdir/GW_FullDisk_4km AREA0487
 
#  Dump digital values and navigation
 
$EXECutil/axform.k 496 CH4_EAST NAV=YES UNIT=TEMP
$EXECutil/axform.k 495 CH4_WEST NAV=YES UNIT=TEMP
#$EXECutil/axform.k 497 CH4_FULL NAV=YES UNIT=TEMP

 
#  Create RCM-grid (FMH definition) temperature analysis 
#  and copy to data directory.
#  Control file is sat_analyses_exp.ctl
 
cp $PARMradar/radar_sat_analyses_exp.ctl sat_analyses_exp.ctl

export pgm=radar_sat_analyses
. prep_step

$EXECradar/radar_sat_analyses >> $pgmout 2>>errout
#err=$? ; export err; err_chk
err=$?
echo "radar_sat_analyses completed with return code $err." 
echo "Radar-grid Tsat analysis is now in file:"
tail -n1 sat_analyses_exp.ctl

exit
