#!/bin/tcsh -f
@ loop = 41
while ($loop <= 70)
set yr = $loop
@ yr1 = $loop + 2000
echo 'YEAR=' $yr1
##################################
setenv HD /Net/water/amishra/RSM_ROMS/FL-DWN/RCP8.5/CLD2/O/netcdf
cd ${HD}
################################################################################
echo 'going to prepare GrADS readable Currents file for' $yr1  >> synopsis_Cur
####################################
rm -rf makedailyU.gs
cat >> makedailyU.gs << EOF
'reinit'
'open /Net/water/amishra/RSM_ROMS/FL-DWN/RCP8.5/CLD2/O/mon/temp/temp.ctl'
'set x 1 129';'set y 1 120'
'set t 10'; 'define tgrd=temp'; 'close 1'
'open /Net/water/amishra/RSM_ROMS/FL-DWN/RCP8.5/CLD2/O/mon/ucur/ucur.ctl'
**'set x 1 129';'set y 1 120'
'set time jan${yr1} dec${yr1}'
'define ucur=lterp(u,tgrd)'
'set sdfwrite -flt ucur.${yr1}.nc'
'sdfwrite ucur'
'quit'
EOF
#*********************************************************************
##################################
/usr/people/amishra/pkg/grads-2.1.a1/bin/grads -blc "run makedailyU.gs"
#################################
wait
echo 'prepared GrADS readable netcdf file for U ' $yr1 >>  synopsis_Cur
rm -rf makedailyU.gs
####################################
rm -rf makedailyV.gs
cat >> makedailyV.gs << EOF
'reinit'
'open /Net/water/amishra/RSM_ROMS/FL-DWN/RCP8.5/CLD2/O/mon/temp/temp.ctl'
'set x 1 129';'set y 1 120'
'set t 10'; 'define tgrd=temp'; 'close 1'
'open /Net/water/amishra/RSM_ROMS/FL-DWN/RCP8.5/CLD2/O/mon/vcur/vcur.ctl'
**'set x 1 129';'set y 1 120'
'set time jan${yr1} dec${yr1}'
'define vcur=lterp(v,tgrd)'
'set sdfwrite -flt vcur.${yr1}.nc'
'sdfwrite vcur'
'quit'
EOF
#*********************************************************************
##################################
/usr/people/amishra/pkg/grads-2.1.a1/bin/grads -blc "run makedailyV.gs"
#################################
wait
echo 'prepared GrADS readable netcdf file for V ' $yr1 >>  synopsis_Cur
rm -rf makedailyV.gs
###################################################################################
 @ loop = $loop + 1
end
exit
