numpy.ma.notmasked_edges(a, axis=None)
[source]
Find the indices of the first and last unmasked values along an axis.
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: |
|
---|---|
Returns: |
|
See also
flatnotmasked_contiguous
, flatnotmasked_edges
, notmasked_contiguous
, clump_masked
, clump_unmasked
>>> 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])
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.ma.notmasked_edges.html