Skip to content
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 #4

dnadeau4 opened this issue Sep 12, 2016 · 4 comments

mean broken on MV array #4

dnadeau4 opened this issue Sep 12, 2016 · 4 comments


Copy link

From @doutriaux1 on August 15, 2016 15:32

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'

Copied from original issue: CDAT/cdat#2088

Copy link
Contributor Author

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

Copy link
Contributor Author

From @doutriaux1 on August 15, 2016 17:53

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

Copy link
Contributor Author

From @doutriaux1 on August 15, 2016 17:53

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

Copy link
Contributor Author

a.mean() was broken again for numpy version 1.12.0

Need to pass a () for to numpy.mean getitem and not [] in tvariable.expertSlice

doutriaux1 pushed a commit that referenced this issue Mar 17, 2017
* Fix #87 ESMF periodicity

* add Test for regriding periodicity

* add UVCDAT URL to retrieve file remotely

* tear down Downloaded files

* Change array test to string test

* Change array to 1d array

* pass slicelist = () for numpy 1.12

* Fix #4 _FillValue exist and missing_value does not in file

* trigger CI

* First conversion to ESMPy

* ignore degenerate and fix corner problem

* esmpy fix for periodicity test

* esmpy fix for merging issues

* esmpy delete print unMappedAction

* add some 2d and 3D test plus devel

* Continue to convert test from ESMP to ESMF

* conver to ESMF

* continue development for ESMF

* disable SSL_CERTIFICATE from urllib; add ESMF test

* move Test to tests

*  rename test files

* if PLOT import matplolib

* add ESMPy to travis

* add mpi4py to travis and circleci

* Fix more ESMF tests

* fix circleci dep and some tests

* fix circleci dep move anonymous download

* Fix mask in test
@doutriaux1 doutriaux1 modified the milestone: 2.10 May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants