-
numpy.ma.flatnotmasked_contiguous(a)
[source] -
Find contiguous unmasked data in a masked array along the given axis.
Parameters: a : narray
The input array.
Returns: slice_list : list
A sorted sequence of slices (start index, end index).
Notes
Only accepts 2-D arrays at most.
Examples
123>>> a
=
np.ma.arange(
10
)
>>> np.ma.flatnotmasked_contiguous(a)
slice
(
0
,
10
,
None
)
1234>>> mask
=
(a <
3
) | (a >
8
) | (a
=
=
5
)
>>> a[mask]
=
np.ma.masked
>>> np.array(a[~a.mask])
array([
3
,
4
,
6
,
7
,
8
])
12345>>> np.ma.flatnotmasked_contiguous(a)
[
slice
(
3
,
5
,
None
),
slice
(
6
,
9
,
None
)]
>>> a[:]
=
np.ma.masked
>>>
print
(np.ma.flatnotmasked_edges(a))
None
numpy.ma.flatnotmasked_contiguous()

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