[Numpy-discussion] bug with with fill_values in masked arrays?
Chris Withers
chris at simplistix.co.uk
Wed Mar 19 07:29:08 EDT 2008
OK, my specific problem with masked arrays is as follows:
>>> a = numpy.array([1,numpy.nan,2])
>>> aa = numpy.ma.masked_where(numpy.isnan(a),a)
>>> aa
array(data =
[ 1.00000000e+00 1.00000000e+20 2.00000000e+00],
mask =
[False True False],
fill_value=1e+020)
>>> numpy.ma.set_fill_value(aa,0)
>>> aa
array(data =
[ 1. 0. 2.],
mask =
[False True False],
fill_value=0)
OK, so this looks like I want it to, however:
>>> [v for v in aa]
[1.0, array(data =
999999,
mask =
True,
fill_value=999999)
, 2.0]
Two questions:
1. why am I not getting my NaN's back?
2. why is the wrong fill value being used here?
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the NumPy-Discussion
mailing list