W3cubDocs

/NumPy 1.17

numpy.ma.clump_masked

numpy.ma.clump_masked(a) [source]

Returns a list of slices corresponding to the masked clumps of a 1-D array. (A “clump” is defined as a contiguous region of the array).

Parameters:
a : ndarray

A one-dimensional masked array.

Returns:
slices : list of slice

The list of slices, one for each continuous region of masked elements in a.

Notes

New in version 1.4.0.

Examples

>>> a = np.ma.masked_array(np.arange(10))
>>> a[[0, 1, 2, 6, 8, 9]] = np.ma.masked
>>> np.ma.clump_masked(a)
[slice(0, 3, None), slice(6, 7, None), slice(8, 10, None)]

© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.ma.clump_masked.html