-
Notifications
You must be signed in to change notification settings - Fork 0
Description
@durack1 what do you think of my problem below?
I have very recently discovered that I may have misused genutil.averager incorrectly for years. I assumed that the order in which you did a spatial average did not matter, but this seems to be only true when the variable is not masked
The results are quite different! I think that the user expects what you get when specifying combinewts=1, except that the default is ZERO! That's why you may want to change the default value
genutil.averager is a very useful component of CDAT but there does not seem to be an example script/notebook using it on the web site. You may want to add one
Example with one time step of clt.nc
No problem here, because there are no masked points
>>> clt.shape
(46, 72)
>>> clt.count()
3312
>>> 46*72
3312
>>> cdutil.averager(clt, axis='xy', weights=['weighted','weighted'])
variable_182
masked_array(data=62.71149853,
mask=False,
fill_value=1e+20)
>>> cdutil.averager(clt, axis='yx', weights=['weighted','weighted'])
variable_190
masked_array(data=62.71149853,
mask=False,
fill_value=1e+20)
>>> cdutil.averager(clt, axis='yx', weights=['weighted','weighted'], combinewts=1)
variable_204
masked_array(data=62.71149853,
mask=False,
fill_value=1e+20)
Example with one time step of tas_cru_1979.nc
Some points are masked, and the values returned by cdutil.averager are quite different
>>> tas.shape
(36, 72)
>>> 36*72
2592
>>> tas.count()
1823
>>> genutil.averager(tas, axis='xy', weights=['weighted','weighted'])
variable_84
masked_array(data=12.62572236,
mask=False,
fill_value=1e+20)
>>> genutil.averager(tas, axis='yx', weights=['weighted','weighted'])
variable_92
masked_array(data=14.68750813,
mask=False,
fill_value=1e+20)
>>> genutil.averager(tas, axis='yx', weights=['weighted','weighted'], combinewts=1)
variable_110
masked_array(data=14.70993489,
mask=False,
fill_value=1e+20)
>>> genutil.averager(tas, axis='xy', weights=['weighted','weighted'], combinewts=1)
variable_130
masked_array(data=14.70993489,
mask=False,
fill_value=1e+20)