You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to produce a spatial average over a region of a variable, after doing a temporal average.
This works for almost all of the regions defined in the NCAR scripts.
However, one region in particular (Antarctica) makes cdutil.averager barf.
f = cdms2.open('/Users/bs1/data/co2-2yr.xml')
v = f('FCTR')
vt = cdutil.averager(v, axis='t')
vt.shape
(360, 720)
vsub = vt(latitude=(-90, -65), longitude=(-180, 180))
vsub.shape
(50, 720)
va = cdutil.averager(vsub, axis='xy')
Traceback (most recent call last):
File "", line 1, in
File "/Users/bs1/uvcdat-devel/build/install/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/genutil/averager.py", line 1118, in averager
V, sumwts = average_engine(V, filled_wtoptions[i])
File "/Users/bs1/uvcdat-devel/build/install/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/genutil/averager.py", line 662, in average_engine
y, return_wts = MV2.average(x, weights=wts, returned=1, axis=0)
File "/Users/bs1/uvcdat-devel/build/install/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/MV2.py", line 405, in average
if returned: maresult, wresult = maresult
TypeError: iteration over a 0-d array
However, this works ok:
vs2 = vt(latitude=(-10, 10), longitude=(90, 150))
vs2.shape
(40, 120)
va2 = cdutil.averager(vs2, axis='xy')
va2.shape
() ##### that is expected; I want a single value when I’m done
va2.data
array(73.2100605668346)
Other regions similar to Antarctica work ok (e.g. all of the Southern Hemisphere - -90, 0 to -180, 180.). Also, things that go negative to negative (e.g. Australia at -30, -20, 110, 145) work fine.
Thoughts? Am I doing something incorrect and getting lucky for the rest of the regions or is there something special about this one?
The text was updated successfully, but these errors were encountered:
Hi Charles,
I’m trying to produce a spatial average over a region of a variable, after doing a temporal average.
This works for almost all of the regions defined in the NCAR scripts.
However, one region in particular (Antarctica) makes cdutil.averager barf.
f = cdms2.open('/Users/bs1/data/co2-2yr.xml')
v = f('FCTR')
vt = cdutil.averager(v, axis='t')
vt.shape
(360, 720)
vsub = vt(latitude=(-90, -65), longitude=(-180, 180))
vsub.shape
(50, 720)
va = cdutil.averager(vsub, axis='xy')
Traceback (most recent call last):
File "", line 1, in
File "/Users/bs1/uvcdat-devel/build/install/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/genutil/averager.py", line 1118, in averager
V, sumwts = average_engine(V, filled_wtoptions[i])
File "/Users/bs1/uvcdat-devel/build/install/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/genutil/averager.py", line 662, in average_engine
y, return_wts = MV2.average(x, weights=wts, returned=1, axis=0)
File "/Users/bs1/uvcdat-devel/build/install/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/MV2.py", line 405, in average
if returned: maresult, wresult = maresult
TypeError: iteration over a 0-d array
However, this works ok:
vs2 = vt(latitude=(-10, 10), longitude=(90, 150))
vs2.shape
(40, 120)
va2 = cdutil.averager(vs2, axis='xy')
va2.shape
() ##### that is expected; I want a single value when I’m done
va2.data
array(73.2100605668346)
Other regions similar to Antarctica work ok (e.g. all of the Southern Hemisphere - -90, 0 to -180, 180.). Also, things that go negative to negative (e.g. Australia at -30, -20, 110, 145) work fine.
Thoughts? Am I doing something incorrect and getting lucky for the rest of the regions or is there something special about this one?
The text was updated successfully, but these errors were encountered: