ma.
flatnotmasked_edges
查找第一个和最后一个未屏蔽值的索引。
期望1-D MaskedArray ,如果所有值都被屏蔽,则返回none。
MaskedArray
输入1-D MaskedArray
数组中第一个和最后一个未屏蔽值的索引。如果所有值都被屏蔽,则返回none。
参见
flatnotmasked_contiguous
notmasked_contiguous
notmasked_edges
clump_masked
clump_unmasked
笔记
只接受一维数组。
实例
>>> a = np.ma.arange(10) >>> np.ma.flatnotmasked_edges(a) array([0, 9])
>>> mask = (a < 3) | (a > 8) | (a == 5) >>> a[mask] = np.ma.masked >>> np.array(a[~a.mask]) array([3, 4, 6, 7, 8])
>>> np.ma.flatnotmasked_edges(a) array([3, 8])
>>> a[:] = np.ma.masked >>> print(np.ma.flatnotmasked_edges(a)) None