scipp.rebin#

scipp.rebin(x, dim, bins)#

Rebin a dimension of a data array or dataset.

The input must contain bin edges for the given dimension dim.

If the input has masks that contain the dimension being rebinned then those masks are applied to the data before rebinning. That is, masked values are treated as zero.

Parameters
Raises

If data cannot be rebinned, e.g., if the existing coordinate is not a bin-edge coordinate.

Returns

Union[Variable, DataArray, Dataset] – Data rebinned according to the new bin edges.