[Numpy-discussion] numpy.ma bug: need sanity check in masked_where
Eric Firing
efiring at hawaii.edu
Mon Mar 17 16:34:41 EDT 2008
Charles R Harris wrote:
> File a ticket.
#703
Eric
>
> On Mon, Mar 17, 2008 at 12:26 PM, Eric Firing <efiring at hawaii.edu
> <mailto: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 <mailto:Numpy-discussion at scipy.org>
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list