-
numpy.ma.masked_inside(x, v1, v2, copy=True)
[source] -
Mask an array inside a given interval.
Shortcut to
masked_where
, wherecondition
is True forx
inside the interval [v1,v2] (v1 <= x <= v2). The boundariesv1
andv2
can be given in either order.See also
-
masked_where
- Mask where a condition is met.
Notes
The array
x
is prefilled with its filling value.Examples
123456>>>
import
numpy.ma as ma
>>> x
=
[
0.31
,
1.2
,
0.01
,
0.2
,
-
0.4
,
-
1.1
]
>>> ma.masked_inside(x,
-
0.3
,
0.3
)
masked_array(data
=
[
0.31
1.2
-
-
-
-
-
0.4
-
1.1
],
mask
=
[
False
False
True
True
False
False
],
fill_value
=
1e
+
20
)
The order of
v1
andv2
doesn?t matter.1234>>> ma.masked_inside(x,
0.3
,
-
0.3
)
masked_array(data
=
[
0.31
1.2
-
-
-
-
-
0.4
-
1.1
],
mask
=
[
False
False
True
True
False
False
],
fill_value
=
1e
+
20
)
-
numpy.ma.masked_inside()

2025-01-10 15:47:30
Please login to continue.