Hello Waheed,<div><br></div><div>First of all you can rewrite your script using a loop so that it would be small and easy to debug.</div><div><br></div><div>If my view is correct, the problem may be here.</div><div> ------</div>
<div>------</div><div>-------<br><div><div>'close 1'</div><div>'define pave=sum9/10'</div><div>'set sdfwrite <a href="http://waheed.nc/" target="_blank">waheed.nc</a>'</div><div>'sdfwrite pave'</div>
</div><div>------</div><div>------</div><div>------<br><br></div><div>Since you have already closed file 1. You donot have coordinate variables lat and lon to define the data variable pave.</div><div><br></div><div><br></div>
<div><br></div><div><br><div class="gmail_quote">On 10 March 2011 15:37, Waheed <span dir="ltr"><<a href="mailto:waheed.met@gmail.com">waheed.met@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<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" target="_blank">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" target="_blank">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" target="_blank">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><br></div>
<div>'undefine p53'</div>
<div>'close 1'</div>
<div>'sdfopen <a href="http://1954.nc" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div style="margin-left:80px"><b>Gibies George, CSIR-RF,</b></div><div style="margin-left:80px"><b>Seasonal Scale Prediction Group,<br>Climate and Global Modelling Division,<br>
Indian Institute of Tropical Meteorology,<br>Dr. Homi Bhabha Road,<br>NCL (P. O.), Pashan,<br>Pune 411008, India.</b><br></div><br><b><a href="http://sites.google.com/site/gibiesge/" style="background-color:rgb(255, 255, 204);color:rgb(51, 51, 255)" target="_blank">http://sites.google.com/site/gibiesge/</a></b><br>
<br>Please Think about the environment. Save paper; Save Trees; and don't print this e-mail unless it is necessary.<br>
</div></div>