原文:https://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.flatnotmasked_contiguous.html
校对:(虚位以待)
numpy.ma.
flatnotmasked_contiguous
(a)[source]沿给定轴在屏蔽数组中找到连续的未屏蔽数据。
参数: | a:narray
|
---|---|
返回: | slice_list:list
|
笔记
只能接受2-D数组。
例子
>>> 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
>>> print(np.ma.flatnotmasked_edges(a))
None