MCPcopy Index your code
hub / github.com/numpy/numpy / clump_masked

Function clump_masked

numpy/ma/extras.py:2175–2208  ·  view source on GitHub ↗

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

(a)

Source from the content-addressed store, hash-verified

2173
2174
2175def clump_masked(a):
2176 """
2177 Returns a list of slices corresponding to the masked clumps of a 1-D array.
2178 (A "clump" is defined as a contiguous region of the array).
2179
2180 Parameters
2181 ----------
2182 a : ndarray
2183 A one-dimensional masked array.
2184
2185 Returns
2186 -------
2187 slices : list of slice
2188 The list of slices, one for each continuous region of masked elements
2189 in `a`.
2190
2191 See Also
2192 --------
2193 flatnotmasked_edges, flatnotmasked_contiguous, notmasked_edges
2194 notmasked_contiguous, clump_unmasked
2195
2196 Examples
2197 --------
2198 >>> import numpy as np
2199 >>> a = np.ma.masked_array(np.arange(10))
2200 >>> a[[0, 1, 2, 6, 8, 9]] = np.ma.masked
2201 >>> np.ma.clump_masked(a)
2202 [slice(0, 3, None), slice(6, 7, None), slice(8, 10, None)]
2203
2204 """
2205 mask = ma.getmask(a)
2206 if mask is nomask:
2207 return []
2208 return _ezclump(mask)
2209
2210
2211###############################################################################

Callers 1

test_clump_maskedMethod · 0.90

Calls 1

_ezclumpFunction · 0.85

Tested by 1

test_clump_maskedMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…