[Numpy-discussion] Setting element to masked in a masked array previously containing no masked values

Pierre GM pgmdevlist at gmail.com
Mon Jun 25 10:38:14 EDT 2007


On Monday 25 June 2007 10:14:21 Jesper Larsen wrote:
> Hi Pierre and others,

> 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.

You're quite welcome.
Corollary: to unmask values, use
myarray[i] = nomask

of course, use with caution: there are cases where unmasking masked values can 
lead to bad surprise (eg, if the masked values were not defined...)


> 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.

You know, the 'new' implementation was designed to be as close as the one 
available in numpy, so that shouldn't be a problem at all. Besides, it fixes 
some issues, so I can't but advise you to try it when you'll see fit...



More information about the NumPy-Discussion mailing list