New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

full averaging weirdness #757

doutriaux1 opened this Issue Oct 7, 2014 · 0 comments


None yet
1 participant

doutriaux1 commented Oct 7, 2014

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 ='/Users/bs1/data/co2-2yr.xml')
v = f('FCTR')
vt = cdutil.averager(v, axis='t')
(360, 720)
vsub = vt(latitude=(-90, -65), longitude=(-180, 180))
(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/", 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/", 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/", 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))
(40, 120)
va2 = cdutil.averager(vs2, axis='xy')
() ##### that is expected; I want a single value when I’m done

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?

@doutriaux1 doutriaux1 self-assigned this Oct 7, 2014

@doutriaux1 doutriaux1 added this to the 2.1 milestone Oct 7, 2014

doutriaux1 added a commit that referenced this issue Oct 28, 2014

doutriaux1 added a commit that referenced this issue Oct 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment