[gradsusr] help in monthly average precipitation script for aphrodite data

gibies george gibies at tropmet.res.in
Thu Mar 10 05:45:00 EST 2011


Hello Waheed,

First of all you can rewrite your script using a loop so that it would be
small and easy to debug.

If my view is correct, the problem may be here.
 ------
------
-------
'close 1'
'define pave=sum9/10'
'set sdfwrite waheed.nc'
'sdfwrite pave'
------
------
------

Since you have already closed file 1.  You donot have coordinate variables
lat and lon to define the data variable pave.




On 10 March 2011 15:37, Waheed <waheed.met at gmail.com> wrote:

> Dear all
>
> Grads version: 2.0.a8
> OS : RHL 5 (32bit).
>
> 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.
> 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.
>
> the script is as follows :
> * monthly average for the month on May from 1951-1960
>
> 'sdfopen 1951.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p51=ave(precip,t=121,t=151)'
> 'close 1'
> 'sdfopen 1952.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p52=ave(precip,t=122,t=152)'
> 'define sum1=p51+p52'
> 'close 1'
> 'undefine p51'
> 'undefine p52'
> 'sdfopen 1953.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p53=ave(precip,t=121,t=151)'
> 'define sum2=sum1+p53'
> 'undefine sum1'
>
> 'undefine p53'
> 'close 1'
> 'sdfopen 1954.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p54=ave(precip,t=121,t=151)'
> 'define sum3=sum2+p54'
> 'undefine sum2'
> 'undefine p54'
> 'close 1'
> 'sdfopen 1955.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p55=ave(precip,t=121,t=151)'
> 'define sum4=sum3+p55'
> 'undefine sum3'
> 'undefine p55'
> 'close 1'
> 'sdfopen 1956.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p56=ave(precip,t=122,t=152)'
> 'define sum5=sum4+p56'
> 'undefine sum4'
> 'undefine p56'
> 'close 1'
> 'sdfopen 1957.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p57=ave(precip,t=121,t=151)'
> 'define sum6=sum5+p57'
> 'undefine sum5'
> 'undefine p57'
> 'close 1'
> 'sdfopen 1958.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p58=ave(precip,t=121,t=151)'
> 'define sum7=sum6+p58'
> 'undefine sum6'
> 'undefine p58'
> 'close 1'
> 'sdfopen 1959.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p59=ave(precip,t=121,t=151)'
> 'define sum8=sum7+p59'
> 'undefine sum7'
> 'undefine p59'
> 'close 1'
> 'sdfopen 1960.nc'
> 'set lat 23.025 37.475'
> 'set lon 60.025 79.975'
> 'define p60=ave(precip,t=122,t=152)'
> 'define sum9=sum8+p60'
> 'undefine sum8'
> 'undefine p60'
> 'close 1'
> 'define pave=sum9/10'
> 'set sdfwrite waheed.nc'
> 'sdfwrite pave'
> 'quit'
>
> It gives an error " define error : no files open yet"
>
> any suggestions for this script or if there is something better please tell
> .
>
> Thanx in advance
>
>
> Best regards
> --
> Waheed Iqbal
>  (Meteorologist)
> Pakistan Meteorological Department
> R & D Islamabad,Pakistan
> +923334547814
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
*Gibies George,   CSIR-RF,*
*Seasonal Scale Prediction Group,
Climate and Global Modelling Division,
Indian Institute of Tropical Meteorology,
Dr. Homi Bhabha Road,
NCL (P. O.), Pashan,
Pune 411008, India.*

*http://sites.google.com/site/gibiesge/*

Please Think about the environment. Save paper; Save Trees; and don't print
this e-mail unless it is necessary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110310/075bd2a5/attachment-0003.html 


More information about the gradsusr mailing list