Thanks Pierre, good to know there are so many tricks available.<br><br>Chao<br><br><div class="gmail_quote">On Tue, Jul 9, 2013 at 4:55 PM, Pierre Gerard-Marchant <span dir="ltr"><<a href="mailto:pgmdevlist@gmail.com" target="_blank">pgmdevlist@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Jul 9, 2013, at 16:38 , Chao YUE <<a href="mailto:chaoyuejoy@gmail.com">chaoyuejoy@gmail.com</a>> wrote:<br>
<br>
> Sorry I didn't the docs very carefully. there is no doc for np.ma.argmax for indeed there is for np.ma.argmin<br>
<br>
</div>Yeah, the doc of the function asks you to go check the doc of the method… Not the best.<br>
<div class="im"><br>
<br>
> so it's an expected behavior rather than a bug. Let some heavy users to say their ideas.<br>
><br>
> Practicaly, the returned value of 0 will be always confused with the values which are not masked<br>
> but do have the minimum or maximum values at the 0 position over the specified axis.<br>
<br>
</div>Well, it's just an index: if you take the corresponding value from the input array, it'll be masked...<br>
<div class="im"><br>
> One way to walk around is:<br>
><br>
><br>
> data_mask = np.ma.mean(axis=0).mask<br>
><br>
> np.ma.masked_array(np.ma.argmax(data,axis=0), mask=data_mask)<br>
<br>
</div>I find easier to use `mask=x.mask.prod(axis)` to get the combined mask along the desired axis (you could also use a `reduce(np.logical_and, x.mask)` for axis=0, but it's less convenient I think).<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div>***********************************************************************************</div>
<div>Chao YUE<br>Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)<br>UMR 1572 CEA-CNRS-UVSQ<br>Batiment 712 - Pe 119<br>91191 GIF Sur YVETTE Cedex</div>
<div>Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16<br></div>

<div>************************************************************************************</div>