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 tokey
.If
order
is ‘descending’, sort such that values are non-increasing according tokey
.
- Parameters
x (VariableLike) – Data to be sorted.
key (Union[str, scipp._scipp.core.Variable]) – Either a 1D variable sort key or a dimension label.
order (Optional[str]) – Sorting order. Valid options are ‘ascending’ and ‘descending’. Default is ‘ascending’.
- Raises
If the key is invalid, e.g., if it does not have exactly one dimension, or if its dtype is not sortable.
- Returns
The sorted equivalent of the input.
- Return type
VariableLike