#!/bin/tcsh -f
@ loop = 86
while ($loop <= 86)
set yr = $loop
@ yr1 = $loop + 1900
echo 'YEAR=' $yr1
#Leap year check
##################################
setenv HD /Net/water/amishra/RSM_ROMS/MONSOON10km/RCM-CLD2/STAMPEDE/O/netcdf
cd ${HD}
foreach var (temperature salinit)
echo $var
echo 'i am here'
##FOREACH var (temperature salinit zeta shflux ssflux)
 IF ($var == temperature) echo 'i am here'

 IF ($var == "salinity") 
echo 'i am here'
exit
echo 'going to prepare GrADS readable' $var ' file for' $yr1  >> synopsis_$var
##################################
rm -rf makedaily.gs
cat>> makedaily.gs << EOF
'reinit'
'open /Net/water/amishra/RSM_ROMS/MONSOON10km/RCM-CLD2/STAMPEDE/O/roms_daily.ctl'
'set x 1 513';'set y 1 386'
'set time 12z1jan${yr1} 12z31dec${yr1}'
**'define ssh = zeta'
'define $nvar = $var(z=30)'
'set sdfwrite -flt $nvar.${yr1}.nc'
'sdfwrite $nvar'
'quit'
EOF
##################################
/usr/people/amishra/pkg/grads-2.1.a1/bin/grads -blc "run makedaily.gs"
#################################
echo 'prepared GrADS readable netcdf file for' $yr1
rm -rf makedaily.gs
end

 @ loop = $loop + 1
end
exit

