Averaging Question
Matt Georgescu
matt1 at CEP.RUTGERS.EDU
Mon Nov 7 15:18:31 EST 2005
Hello fellow GrADS users,
I have a netCDF dataset of a particular variable. The data is available
globally but I only intend to use a subset of it, over the US.
'sdfopen soilw.0-10cm.gauss.'year'.nc'
'set t 122'
'set lon -165 -30'
'set y 46 92'
I am simply setting up my domain of interest with the above set lon/set y
commands.
What i want to do is:
a) re-write the data, over the domain specified in GrADS and Fortran
readable binary. That part is straightforward, using the "d
variable_name" command, output to a file (see lines below):
'set fwrite soil_coarse.grads'
'set gxout fwrite'
'd const(soilw,0.,-u)'
b) I also want to take the mean of an area within the domain specified
above (ie the mean of just a subset of that domain), but i want both to be
written to the same file (so that when I open the file, a subset of the
file has just 1 value over a geographical area). I tried a variety of
commands (including aave/amean, etc.):
'set x 1'
'set y 1'
'define meanwgp=sumg((soilw,x=-87,x=-15)/73,y=46,y=92)/47'
'set lon -120 -100'
'set lat 30 40'
'd meanwgp'
'disable fwrite'
but the end result is the same. The mean of a subset of the domain i
initially impose is never taken and all i get is the original values
(rather than the mean).
Does anyone have a suggestion of what I coould do alternatively?
thanks,
matt
More information about the gradsusr
mailing list