A reimplementation of MaskedArray

Pierre GM pgmdevlist at gmail.com
Wed Nov 8 15:08:25 CST 2006


> A good candidate for "should be masked" marked is NaN. It is supposed
> to mean, more or less, "no sensible value". 

Which might turn out out to be the best indeed. Michael's application would 
then look like
>>> import numpy as N
>>> import maskedarray as MA
>>> maskit = N.nan
>>> test = N.array([1,2,maskit])
>>> test_ma1 = MA.array(x,mask=N.isnan(x))

> Switching to a MaskedArray might have
> been a better idea, but the NaNs were a rare occurrence.
Once again, that's a situation when one would use masked arrays. 

> If you've got floating point, you can again fill in NaNs, but you have
> a good point about wanting to extract the original values that were
> masked out. Depending on what one is doing, one might want one or the
> other.

In any case, I think we should stick to the numpy.core.ma default behavior for 
backwards compatibility. If you really wanht to distinguish between several 
kind of masks (one for missing data, one for data to discard temporarily), 
that could be done by defining a special subclass. But is it really needed ? 
A smart use of filled and masked_values should do the trick in most cases.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list