numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
notmasked_edges(a, axis=None)

If all values are masked, return None. Otherwise, return a list of two tuples, corresponding to the indices of the first and last unmasked values respectively.

Parameters

a : array_like

The input array.

axis : int, optional

Axis along which to perform the operation. If None (default), applies to a flattened version of the array.

Returns

edges : ndarray or list

An array of start and end indexes if there are any masked data in the array. If there are no masked data in the array, :None:None:`edges` is a list of the first and last index.

Find the indices of the first and last unmasked values along an axis.

See Also

clump_masked
clump_unmasked
flatnotmasked_contiguous
flatnotmasked_edges
notmasked_contiguous

Examples

>>> a = np.arange(9).reshape((3, 3))
... m = np.zeros_like(a)
... m[1:, 1:] = 1
>>> am = np.ma.array(a, mask=m)
... np.array(am[~am.mask]) array([0, 1, 2, 3, 6])
>>> np.ma.notmasked_edges(am)
array([0, 6])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.ma.extras.clump_unmasked numpy.ma.extras.notmasked_contiguous numpy.ma.extras.flatnotmasked_contiguous numpy.ma.extras.clump_masked numpy.ma.extras.flatnotmasked_edges

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/ma/extras.py#1577
type: <class 'function'>
Commit: