[Numpy-discussion] bug with with fill_values in masked arrays?
Chris Withers
chris at simplistix.co.uk
Wed Mar 26 14:47:22 EDT 2008
Matt Knox wrote:
> data = [1., 2., 3., np.nan, 5., 6.]
> mask = [0, 0, 0, 1, 0, 0]
I'm creating the ma with ma.masked_where...
> marr = ma.array(data, mask=mask)
> marr.set_fill_value(55)
> print marr[0] is ma.masked # False
> print marr[3] # ma.masked constant
Yeah, and this is where I have the problem. The masked constant has a
fill value of 99999, rather than 55. That is annoying.
> filled_arr = marr.filled()
> print filled_arr # nan value is replaced with fill value of 55
Right, and this is how I currently work around the problem.
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the NumPy-Discussion
mailing list