{ } Raw JSON

bundles / numpy 2.4.4 / numpy / ma / extras / flatnotmasked_contiguous

function

numpy.ma.extras:flatnotmasked_contiguous

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

Signature

def   flatnotmasked_contiguous ( a )

Summary

Find contiguous unmasked data in a masked array.

Parameters

a : array_like

The input array.

Returns

slice_list : list

A sorted sequence of slice objects (start index, end index).

Notes

Only accepts 2-D arrays at most.

Examples

import numpy as np
a = np.ma.arange(10)
np.ma.flatnotmasked_contiguous(a)
mask = (a < 3) | (a > 8) | (a == 5)
a[mask] = np.ma.masked
np.array(a[~a.mask])
np.ma.flatnotmasked_contiguous(a)
a[:] = np.ma.masked
np.ma.flatnotmasked_contiguous(a)

See also

clump_masked
clump_unmasked
flatnotmasked_edges
notmasked_contiguous
notmasked_edges

Aliases

  • numpy.ma.flatnotmasked_contiguous