#!/bin/csh

set curr_dir = `pwd`


set  per0    = (  25 40 50 100 143 )
set  freq =   ( 0.04 0.025 0.02 0.01 0.007 )
set  avgvel = (  4.06 3.79 3.95 4.05 4.18 )


foreach iper (  1 2 3 4 5 ) 

set  per = $per0[$iper]
set freqtp = ${freq[$iper]}

set fnout = velgridinp.${per}.1.65.2.sa360kern


echo 1                         >  $fnout
echo 0                         >> $fnout
echo .125 65.                  >> $fnout
echo invrsnodes2               >> $fnout
echo -162 -150  14 27         >> $fnout
echo grid.${per}.360.65.2.65   >> $fnout
echo covar.${per}.1.65.2.sa360kern >> $fnout
echo stddev.${per}.360.65.2.65 >> $fnout
cat  velarea.${per}.1.65.2.sa360kern >> $fnout

./gridgenvar.yang_v2  < $fnout


echo grid.${per}.360.65.2.65 > tempperinp
echo grid.${per}.360.65.2.65.per >> tempperinp
echo ${avgvel[$iper]} >> tempperinp

./pvelper  < tempperinp


echo stddev.${per}.360.65.2.65 > tempperinp
echo stddev.${per}.360.65.2.65.per >> tempperinp
echo ${avgvel[$iper]} >> tempperinp

./pstdper < tempperinp  



csh 2_PW_plot_covarvel_per_v2.gmt  grid.${per}.360.65.2.65.per 4.cpt grid.${per}.360.65.2.65.per.ps

end
