clouddrift.ragged.rowsize_to_index#
- clouddrift.ragged.rowsize_to_index(rowsize: list | ndarray | DataArray) ndarray [source]#
Convert a list of row sizes to a list of indices.
This function is typically used to obtain the indices of data rows organized in a ragged array.
Parameters#
- rowsizelist or np.ndarray or xr.DataArray
A list of row sizes.
Returns#
- np.ndarray
A list of indices.
Examples#
To obtain the indices within a ragged array of three consecutive rows of sizes 100, 202, and 53:
>>> rowsize_to_index([100, 202, 53]) array([ 0, 100, 302, 355])