[Numpy-discussion] Bug with MA and reduce?

Ludwig M Brinckmann ludwigbrinckmann at gmail.com
Fri Jul 27 06:15:21 EDT 2007

I have ma.minimum.reduce return a minimum value that does not exist in the

The following code prints -1 as the minimum of the MA, I believe it should
be 1.

import numpy
shape = (100)
data = numpy.ones(shape, numpy.int16)
data[2:40] = 3  # dummy data
data[45:70] = -999 # null values
mask = numpy.ma.make_mask_none(data.shape)
mask[data == -999] = True
ma = numpy.ma.MaskedArray(data, mask = mask)
min = numpy.ma.minimum.reduce(ma,0)
print min

Am I doing something really stupid here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070727/6792e253/attachment.html>

More information about the NumPy-Discussion mailing list