cf.CellMethod.sorted

CellMethod.sorted(indices=None)[source]

Return a new cell method construct with sorted axes.

The axes are sorted by domain axis construct identifier or standard name, and any intervals are sorted accordingly.

New in version (cfdm): 1.7.0

Parameters
indices: ordered sequence of int, optional

Sort the axes with the given indices. By default the axes are sorted by domain axis construct identifier or standard name.

Returns
CellMethod

A new cell method construct with sorted axes.

Examples:

>>> cm = cf.CellMethod(axes=['domainaxis1', 'domainaxis0'],
...                      method='mean',
...                      qualifiers={'interval': [1, 2]})
>>> cm
<CellMethod: domainaxis1: domainaxis0: mean (interval: 1 interval: 2)>
>>> cm.sorted()
<CellMethod: domainaxis0: domainaxis1: mean (interval: 2 interval: 1)>
>>> cm = cf.CellMethod(axes=['domainaxis0', 'area'],
...                      method='mean',
...                      qualifiers={'interval': [1, 2]})
>>> cm
<CellMethod: domainaxis0: area: mean (interval: 1 interval: 2)>
>>> cm.sorted()
<CellMethod: area: domainaxis0: mean (interval: 2 interval: 1)>