ma.
flatnotmasked_contiguous
沿给定轴在屏蔽数组中查找连续的未屏蔽数据。
输入数组。
已排序的序列 slice 对象(开始索引、结束索引)。
在 1.15.0 版更改: 对于完全屏蔽的数组,现在返回空列表而不是无列表
参见
flatnotmasked_edges
notmasked_contiguous
notmasked_edges
clump_masked
clump_unmasked
笔记
最多只接受二维数组。
实例
>>> a = np.ma.arange(10) >>> np.ma.flatnotmasked_contiguous(a) [slice(0, 10, None)]
>>> 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_contiguous(a) [slice(3, 5, None), slice(6, 9, None)] >>> a[:] = np.ma.masked >>> np.ma.flatnotmasked_contiguous(a) []