scipp.allsorted

scipp.allsorted

scipp.allsorted(x, dim, order='ascending')

Check if the values of a variable are sorted.

  • If order is ‘ascending’, check if values are non-decreasing along dim.

  • If order is ‘descending’, check if values are non-increasing along dim.

Parameters
  • x (scipp._scipp.core.Variable) – Variable to check.

  • dim (str) – Dimension along which order is checked.

  • order (Optional[str]) – Sorting order. Valid options are ‘ascending’ and ‘descending’. Default is ‘ascending’.

Returns

True if the variable values are monotonously ascending or descending (depending on the requested order), False otherwise.

Return type

bool