Thanks. You mean actually when numpy handle masked array, it will first treat all the base data, and then apply the mask after the treatment.<br>and normally the base data of maksed elements will very likely to intrigure these errors, and you will see a lot errory warning or print in the process,<br>
and will make it impossible to see the error information your want to see for those elements that are not masked but still can intriguer the error you would like to see or check. I didn't realize this. It's a good to overwrite the error setting. <br>
<br>thanks for your explanation.<br><br>Chao<br><br><br><div class="gmail_quote">On Fri, Dec 14, 2012 at 3:15 PM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@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">On Fri, Dec 14, 2012 at 1:57 PM, Chao YUE <<a href="mailto:chaoyuejoy@gmail.com">chaoyuejoy@gmail.com</a>> wrote:<br>

> Dear all,<br>
><br>
> I tried to capture the zero divide error when I divide a masked array by<br>
> another. It seems that np.seterr is not working for masked array?<br>
> when I do np.divide on two masked array, it directly put the zero divides<br>
> part as being masked. The np.seterr works if the two arrays for dividing are<br>
> not masked arrays.<br>
> could anyone explain? thanks!!<br>
<br>
</div><a href="http://numpy.ma" target="_blank">numpy.ma</a> uses np.seterr(divide='ignore', invalid='ignore') for most of<br>
its operations, so it is overriding your settings. This is usually<br>
desirable since many of the masked values will be trip these errors<br>
spuriously even though they will be masked out in the result.<br>
<br>
--<br>
Robert Kern<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>
</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><br>