[Numpy-discussion] numpy.ma bug: need sanity check in masked_where

Charles R Harris charlesr.harris at gmail.com
Mon Mar 17 14:33:57 EDT 2008


File a ticket.

On Mon, Mar 17, 2008 at 12:26 PM, Eric Firing <efiring at hawaii.edu> wrote:

> Pierre,
>
> I just tripped over what boils down to the sequence given below.  It
> would be useful if the error in line 53 were trapped right away; as it
> is, it results in a masked array that looks reasonable but fails in a
> non-obvious way.
>
> Eric
>
> In [52]:x = [1,2]
>
> In [53]:y = ma.masked_where(False, x)
>
> In [54]:y
> Out[54]:
> masked_array(data = [1 2],
>       mask = False,
>       fill_value=999999)
>
>
> In [55]:y[1]
>
> ---------------------------------------------------------------------------
> IndexError                                Traceback (most recent call
> last)
>
> /home/efiring/<ipython console> in <module>()
>
> /usr/local/lib/python2.5/site-packages/numpy/ma/core.pyc in
> __getitem__(self, indx)
>    1307         if not getattr(dout,'ndim', False):
>    1308             # Just a scalar............
> -> 1309             if m is not nomask and m[indx]:
>    1310                 return masked
>    1311         else:
>
> IndexError: 0-d arrays can't be indexed
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080317/dbae5f2e/attachment.html>


More information about the NumPy-Discussion mailing list