clouddrift.ragged.prune#
- clouddrift.ragged.prune(ragged: list | ndarray | Series | DataArray, rowsize: list | ndarray | Series | DataArray, min_rowsize: float) tuple[ndarray, ndarray][source]#
- Within a ragged array, removes arrays less than a specified row size. - Parameters#- raggednp.ndarray or pd.Series or xr.DataArray
- A ragged array. 
- rowsizelist or np.ndarray[int] or pd.Series or xr.DataArray[int]
- The size of each row in the input ragged array. 
- min_rowsize :
- The minimum row size that will be kept. 
 - Returns#- tuple[np.ndarray, np.ndarray]
- A tuple of ragged array and size of each row. 
 - Examples#- >>> from clouddrift.ragged import prune >>> import numpy as np >>> prune(np.array([1, 2, 3, 0, -1, -2]), np.array([3, 1, 2]),2) (array([ 1, 2, 3, -1, -2]), array([3, 2])) - Raises#- ValueError
- If the sum of - rowsizedoes not equal the length of- arrays.
- IndexError
- If empty - ragged.
 - See Also#- segment(), chunk
