flox.xarray.rechunk_for_blockwise

flox.xarray.rechunk_for_blockwise(obj, dim, labels)[source]

Rechunks array so that group boundaries line up with chunk boundaries, allowing embarrassingly parallel group reductions.

This only works when the groups are sequential (e.g. labels = [0,0,0,1,1,1,1,2,2]). Such patterns occur when using .resample.

Parameters:
objDataArray or Dataset

Array to rechunk

dimhashable

Name of dimension to rechunk

labelsDataArray

Group labels

Returns:
DataArray or Dataset

Xarray object with rechunked arrays.