area average script question

Teddy Allen teddyallen at YAHOO.COM
Tue Feb 24 09:50:05 EST 2009

Dear GrADS users,
I have taken the many tips from previous postings and external templates to produce a script that displays a time series of rainfall anomalies taken from the monthly GPCP dataset. The script works great as long as the geographic coordinates are relayed as a point location (ex: lat=3N, lon=6N), but, I am more interested in determining rainfall anomalies for average area regions (ex: lat=6N,lat=11N,lon=5W,lon=2E). 
I have tried to incorporate the GrADS command AAVE to calculate the area average, but I am not getting the desired results. Please see the below script for details:
*open gpcp monthly data file
'sdfopen c:\testdata\netcdf\'
'set grid off'
'set grads off'
*create 12 x-axis labels; one for each month
'set t 1 12'
*define new variable to create monthly climatology for rainfall starting from Jan 1997
'define rainclim = ave(precip, t+216, t=347, 12)'
'modify rainclim seasonal'
'set t 1 last'
*define new variable for anomaly of monthly rainfall
'define anom = precip - rainclim'
*set time period for anomaly time series
'set t 336 347'
*define geographic point location to assess rainfall anomaly for the given time period
'set lat 8'
'set lon 1'
'd anom'
I would like to replace the set lat and set lon commands with:
'define region = aave(anom,lat=6,lat=11,lon=355,lon=2)
which should average rainfall anomaly for that area. I then change 'd anom' to 'd region', but nothing happens. Can anybody spot the error? Also, is there a problem when the x dimension varies from 0 to 360 and you are interested in the region from 357 to 1 (5W to 2E), obviously the order from 357 to 1 does not obey the proper value order? Has anybody else overcome issues with the AAVE command?
Thank you for your time.
teddy allen


"To move quickly, go alone. To move far, go together."
African Proverb                                                                                                        *

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the gradsusr mailing list