[Numpy-discussion] Setting element to masked in a masked array previously containing no masked values
Jesper Larsen
jl at dmi.dk
Mon Jun 25 10:14:21 EDT 2007
Hi Pierre and others,
On Monday 25 June 2007 15:37, Pierre GM wrote:
> On Monday 25 June 2007 05:12:01 Jesper Larsen wrote:
> > myarray.mask[i] = True
>
> Mmh. Experience shows that directly accessing the mask can lead to bad
> surprises. To mask a series of values in an array, the easiest (and
> recommended method) is
>
> myarray[i] = masked
I was not aware that the way to use masked arrays was as you describe. I
thought you had to somehow modify the mask (but the method you describe is of
course much more elegant). Thanks for answering my very basic question.
> A side issue is the kind of implementation of masked arrays you want. There
> are currently two, one directly accessible through numpy.core.ma, another
> available in the sandbox of the scipy svn site, as maskedarray. This latter
> considers MaskedArray as a subclass of ndarray, which makes it easier to
> define subclasses. Moreover, it gives access to soft/hard masks, masked
> records, more stats functions, and thanks to Eric Firing, can be used
> directly with matplotlib... I'd be quite happy if you could give it a try
> and send me your feedback.
No, no, I don't want that kind of implementation - I just want to figure out
how the current implementation works:-) When I get some more experience in
using masked arrays and require some of the functionality that you describe I
will give it a try.
- Jesper
More information about the NumPy-Discussion
mailing list