<div dir="ltr"><div>Dear all</div>
<div> </div>
<div><font style="BACKGROUND-COLOR: #ffffff" color="#ff0000">Grads version: 2.0.a8</font></div>
<div><font style="BACKGROUND-COLOR: #ffffff" color="#ff0000">OS : RHL 5 (32bit).</font></div>
<div> </div>
<div>i am trying to find the monthly average precipitation from yearly nc files of daily data. i want to get ouput in nc format but monthly average for each month.</div>
<div>dkiktev had sent me a script and i made modifications in it. now i m running it for 10 years from 1951-1960 for the month of May . But i am having trouble with it.</div>
<div> </div>
<div>the script is as follows :</div>
<div>* monthly average for the month on May from 1951-1960</div>
<div> </div>
<div>'sdfopen <a href="http://1951.nc">1951.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p51=ave(precip,t=121,t=151)'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1952.nc">1952.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p52=ave(precip,t=122,t=152)'</div>
<div>'define sum1=p51+p52'</div>
<div>'close 1'</div>
<div>'undefine p51'</div>
<div>'undefine p52'</div>
<div>'sdfopen <a href="http://1953.nc">1953.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p53=ave(precip,t=121,t=151)'</div>
<div>'define sum2=sum1+p53'</div>
<div>'undefine sum1'</div>
<div>'undefine p53'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1954.nc">1954.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p54=ave(precip,t=121,t=151)'</div>
<div>'define sum3=sum2+p54'</div>
<div>'undefine sum2'</div>
<div>'undefine p54'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1955.nc">1955.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p55=ave(precip,t=121,t=151)'</div>
<div>'define sum4=sum3+p55'</div>
<div>'undefine sum3'</div>
<div>'undefine p55'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1956.nc">1956.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p56=ave(precip,t=122,t=152)'</div>
<div>'define sum5=sum4+p56'</div>
<div>'undefine sum4'</div>
<div>'undefine p56'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1957.nc">1957.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p57=ave(precip,t=121,t=151)'</div>
<div>'define sum6=sum5+p57'</div>
<div>'undefine sum5'</div>
<div>'undefine p57'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1958.nc">1958.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p58=ave(precip,t=121,t=151)'</div>
<div>'define sum7=sum6+p58'</div>
<div>'undefine sum6'</div>
<div>'undefine p58'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1959.nc">1959.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p59=ave(precip,t=121,t=151)'</div>
<div>'define sum8=sum7+p59'</div>
<div>'undefine sum7'</div>
<div>'undefine p59'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1960.nc">1960.nc</a>'</div>
<div>'set lat 23.025 37.475'</div>
<div>'set lon 60.025 79.975'</div>
<div>'define p60=ave(precip,t=122,t=152)'</div>
<div>'define sum9=sum8+p60'</div>
<div>'undefine sum8'</div>
<div>'undefine p60'</div>
<div>'close 1'</div>
<div>'define pave=sum9/10'</div>
<div>'set sdfwrite <a href="http://waheed.nc">waheed.nc</a>'</div>
<div>'sdfwrite pave'</div>
<div>'quit'</div>
<div> </div>
<div><font color="#cc33cc">It gives an error " define error : no files open yet"</font></div>
<div> </div>
<div>any suggestions for this script or if there is something better please tell .</div>
<div> </div>
<div>Thanx in advance</div>
<div> </div>
<div> </div>
<div>Best regards</div>
<div>-- </div>
<div>Waheed Iqbal</div>
<div> (Meteorologist)<br>Pakistan Meteorological Department<br>R & D Islamabad,Pakistan<br>+923334547814</div>
<div> </div>
<div> </div></div>