This is a follow-up to an earlier mail that reported a suspected bug in the reduce/minimum operation of <a href="http://numpy.ma">numpy.ma</a>.<br><br>I have tried the same code with the scipy sandbox maskedarray implementation and that gives me the correct output. For comparison:
<br><br># import <a href="http://numpy.core.ma">numpy.core.ma</a> as MA<br>import maskedarray as MA<br>shape = (100)<br>data = numpy.ones(shape, numpy.int16)<br>data[2:40] = 3<br>data[45:70] = -999<br>mask = MA.make_mask_none
(data.shape)<br>mask[data == -999] = True<br>ma = MA.MaskedArray(data, mask = mask)<br>min = MA.minimum.reduce(ma,0)<br>print min<br><br>With maskedarray I get, as expected 1, with <a href="http://numpy.core.ma">numpy.core.ma
</a> I get -1, a value that is not in the array.<br><br>I am using Python 2.44 on XP, the maskedarray is the svn latest, the <a href="http://numpy.core.ma">numpy.core.ma</a> was 1.0.2, but I have tested it with only the current svn version of 
ma.py and it produces the wrong output.<br><br><br>Ludwig<br><br><br><br><div><span class="gmail_quote">On 27/07/07, <b class="gmail_sendername">Ludwig M Brinckmann</b> <<a href="mailto:ludwigbrinckmann@gmail.com">ludwigbrinckmann@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I have ma.minimum.reduce return a minimum value that does not exist in the array.
<br><br>The following code prints -1 as the minimum of the MA, I believe it should be 1.<br><br>import numpy<br>shape = (100)<br>data = numpy.ones
(shape, numpy.int16)<br>data[2:40] = 3  # dummy data<br>data[45:70] = -999 # null values<br>mask = numpy.ma.make_mask_none(data.shape)<br>mask[data == -999] = True<br>ma = numpy.ma.MaskedArray(data, mask = mask)<br>min = 
numpy.ma.minimum.reduce(ma,0)<br>print min<br><br>Am I doing something really stupid here?<br><span class="sg"><br>Ludwig<br><br>
</span></blockquote></div><br>