scipp.sort#

scipp.sort(x, key, order='ascending')#

Sort variable along a dimension by a sort key or dimension label.

  • If order is ‘ascending’, sort such that values are non-decreasing according to key.

  • If order is ‘descending’, sort such that values are non-increasing according to key.

Parameters
Returns

scipp.typing.VariableLike – The sorted equivalent of the input with the same type.

Raises

scipp.DimensionError – If the key is a Variable that does not have exactly 1 dimension.