# QSUB -lT 80 -lt 60 -q prem -lM 2Mw -eo -s /bin/csh -r getndcs
date
ja
 
cd $TMPDIR
set job = getndcs
#set QSUB_REQNAME = $0.$$
batchname $job.$$
set ms1 = "/ISRADAR/EHP781102A"
set ms2 = "/ISRADAR/GPI600101A"
set ms3 = "/ISRADAR/IMF631127A"
set ms4 = "/ISRADAR/AEI780101A"
set ms5 = "/ISRADAR/DST570101A"
set ofl = "cedar.hao:ntwk/S${QSUB_REQNAME}out"
set ofp = "cedar.hao:ntwk/S${QSUB_REQNAME}cgm"
set ofx = "cedar.hao:ntwk/S${QSUB_REQNAME}lex"
 
#       Put COS blocked read files in a semi-volitile directory
set fld = "/usr/tmp/$user"
set lf1 = $fld"/"$ms1:t
set lf2 = $fld"/"$ms2:t
set lf3 = $fld"/"$ms3:t
set lf4 = $fld"/"$ms4:t
set lf5 = $fld"/"$ms5:t
if (! -e $fld) mkdir $fld
if (! -e $lf1) msread $lf1 $ms1
if (! -e $lf2) msread $lf2 $ms2
if (! -e $lf3) msread $lf3 $ms3
if (! -e $lf4) msread $lf4 $ms4
if (! -e $lf5) msread $lf5 $ms5
if ($status != 0) exit $status

cat << EOF >! $job.inp
  0 1 0 0 0 0
'$lf1' '$lf2' '$lf3' '$lf4' '$lf5'
1979 0101    0    0 1996 1231 2400    0 1
EOF
#----------INPUTS ARE:--------------------------------------------------
#   READ IGETHP,IGETGPI,IGETIMF,IGETAE,IGETDST , ICALCT
#   READ NAMEHP, NAMGPI, NAMIMF, NAMAE, NAMDST
#   READ IBEGT, IENDT, LEXBDAY  (or done; i.e., repeat this line for each
#                                time interval to obtain indices)
#  Variable definitions:
#   IGETHP  = 1,0 if do,not get Estimated Hemispheric Power data
#   IGETGPI = 1,0 if do,not get GeoPhysical Indices (SS#,F107,Kp,Ap,..)
#   IGETIMF = 1,0 if do,not get Interplanet Mag Fld data (IMF,VSW,DSW)
#   IGETAE  = 1,0 if do,not get AE hourly data
#   IGETDST = 1,0 if do,not get Dst
#   ICALCT  = 1,0 if do,not calculate crosstail potential and perform
#             lexical write
#   NAMEHP...NAMDST = Name of input files containing indices (apostrophy
#             delimited) must be defined when option is selected; e.g.,
#             if not requesting ae, set IGETAE=0 and NAMAE=' '.
#   IBEGT,IENDT = yyyy mmdd hhmm cs yyyy mmdd hhmm cs defines the UT time
#             interval for this frames plot values
#   LEXBDAY = UT day number in lexical output of the begin day; only
#             relevent when ICALCT=1.
#  Current data availability:
#   HP from  2 Nov 78 to 19 Jul 86
#   GPI from 1 Jan 60 to 31 Jan 92
#   hourly IMF from 27 Nov 63 to 11 May 91
#   hourly AE  from  1 Jan 78 to 31 Dec 86
#   hourly DST from  1 Jan 57 to 31 Dec 90
#
INCLUDE -h *.f Makefile
make || goto mkfail					
$job < $job.inp || goto xfail
ja -st 
exit
#
# Jump here if make failed:
#
mkfail:
echo \>\>\> make failed -- exit \<\<\<
ja -st 
exit
#
# Jump here if execution failed (could put debug or other cleanup here):
#
xfail:
echo \>\>\> execution failed -- exit \<\<\<
ja -st 
exit
