scipp.rebin
scipp.rebin#
- scipp.rebin(x, dim, bins)#
Rebin a dimension of a data array or dataset.
The coordinate of the input for the given dimension dim must contain bin edges.
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
x (
scipp.DataArray
orscipp.Dataset
) – Data to rebin.dim (
str
) – Dimension to rebin over.bins (
Variable
) – New bin edges.
- Returns
Same type as x
– Data rebinned according to the new bin edges.- Raises
scipp.CoordError – If the existing coordinate is not a bin-edge coordinate.