On this page
numpy.ma.masked_outside
numpy.ma.masked_outside(x, v1, v2, copy=True)[source]-
Mask an array outside a given interval.
Shortcut to
masked_where, whereconditionis True forxoutside the interval [v1,v2] (x < v1)|(x > v2). The boundariesv1andv2can be given in either order.See also
masked_where- Mask where a condition is met.
Notes
The array
xis prefilled with its filling value.Examples
>>> import numpy.ma as ma >>> x = [0.31, 1.2, 0.01, 0.2, -0.4, -1.1] >>> ma.masked_outside(x, -0.3, 0.3) masked_array(data=[--, --, 0.01, 0.2, --, --], mask=[ True, True, False, False, True, True], fill_value=1e+20)The order of
v1andv2doesn’t matter.>>> ma.masked_outside(x, 0.3, -0.3) masked_array(data=[--, --, 0.01, 0.2, --, --], mask=[ True, True, False, False, True, True], fill_value=1e+20)
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.ma.masked_outside.html