Open
Description
Proposed new feature or change:
I would like to have a function like np.ma.clump_masked
or np.ma.clump_unmasked
that I can use on ordinary arrays to find runs of elements with identical values. My application is in astronomy, where I am computing a boolean array that represents whether a target is observable in a given time step. I want to convert this to a list of time intervals.
Under the hood, both of these functions call a helper called _ezclump
that has the following docstring:
Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
This is almost exactly what I want. (Really, I want to clump values along each row in a 2D array, and return a list of a list of slices... but this is close enough.)
This could be called np.flat_clump_nonzero
or something similar.
Metadata
Metadata
Assignees
Labels
No labels