Open
Description
When doing a mathematical operation on a masked array, and some elements are invalid for the particular mathematical operation, numpy should not issue a warning if all invalid elements are masked.
This cannot be handled by numpy.seterr
: I want numpy to warn or raise when performing an invalid operation on any non-masked value, but to be silent when performing an invalid operation on a masked value.
In [1]: A = arange(-2, 5)/2
In [2]: Am = numpy.ma.masked_less_equal(A, 0)
In [3]: numpy.log10(Am)
/export/data/home/gholl/venv/gerrit/bin/ipython3:1: RuntimeWarning: divide by zero encountered in log10
#!/export/data/home/gholl/venv/gerrit/bin/python3.4
/export/data/home/gholl/venv/gerrit/bin/ipython3:1: RuntimeWarning: invalid value encountered in log10
#!/export/data/home/gholl/venv/gerrit/bin/python3.4
Out[3]:
masked_array(data = [-- -- -- -0.3010299956639812 0.0 0.17609125905568124 0.3010299956639812],
mask = [ True True True False False False False],
fill_value = 1e+20)