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

mean broken on MV array #2088

Closed
doutriaux1 opened this Issue Aug 15, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@doutriaux1
Member

doutriaux1 commented Aug 15, 2016

In [1]: import MV2

In [2]: a=MV2.ones((13,14))

In [3]: a.mean()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-dc887f7a7bfb> in <module>()
----> 1 a.mean()

/export/doutriaux1/anaconda2/envs/blah/lib/python2.7/site-packages/numpy/ma/core.pyc in mean(self, axis, dtype, out)
   4779         """
   4780         if self._mask is nomask:
-> 4781             result = super(MaskedArray, self).mean(axis=axis, dtype=dtype)
   4782         else:
   4783             dsum = self.sum(axis=axis, dtype=dtype)

/export/doutriaux1/anaconda2/envs/blah/lib/python2.7/site-packages/numpy/core/_methods.pyc in _mean(a, axis, dtype, out, keepdims)
     67     if isinstance(ret, mu.ndarray):
     68         ret = um.true_divide(
---> 69                 ret, rcount, out=ret, casting='unsafe', subok=False)
     70     elif hasattr(ret, 'dtype'):
     71         ret = ret.dtype.type(ret / rcount)

/export/doutriaux1/anaconda2/envs/blah/lib/python2.7/site-packages/numpy/ma/core.pyc in __array_wrap__(self, obj, context)
   2897                 return masked
   2898             else:
-> 2899                 result._mask = m
   2900                 result._sharedmask = False
   2901         #....

AttributeError: 'numpy.ndarray' object has no attribute '_mask'
@dnadeau4

This comment has been minimized.

Contributor

dnadeau4 commented Aug 15, 2016

@doutriaux1 What is your cdms2.MV2.numpy.version.version. I have 1.11.1 and this test works fine.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Aug 15, 2016

@dnadeau4 that was my suspicion, I'm using 1.9.2, let's try to merge numpy 1.11 in as fast as possible.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Aug 15, 2016

oh and let's add a test for this as well.

dnadeau4 added a commit that referenced this issue Aug 15, 2016

@dnadeau4

This comment has been minimized.

Contributor

dnadeau4 commented Sep 12, 2016

This issue was moved to CDAT/cdms#4

@dnadeau4 dnadeau4 closed this Sep 12, 2016

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