You are viewing an older version (2.4.3).Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ma / extras / clump_unmasked

function

numpy.ma.extras:clump_unmasked

source: /numpy/ma/extras.py:2139

Signature

def clump_unmasked(a)

Summary

Return list of slices corresponding to the unmasked 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 unmasked elements in a.

Examples

import numpy as np
a = np.ma.masked_array(np.arange(10))
a[[0, 1, 2, 6, 8, 9]] = np.ma.masked
✓
np.ma.clump_unmasked(a)
✗
[slice(np.int64(3), np.int64(6), None), slice(np.int64(7), np.int64(8), None)]

See also

clump_masked
flatnotmasked_contiguous
flatnotmasked_edges
notmasked_contiguous
notmasked_edges

Aliases

  • numpy.ma.clump_unmasked