sort
- sort(fs, [keys, [orders, ]]ascending=True)
- Fieldset.sort([keys, [orders, ]]ascending=True)
Sorts
fs
according to the specified options.- Parameters
fs (
Fieldset
) – input fieldsetkeys (str or list) – sorting key(s), they must be valid ecCodes keys
orders (str or list) – sorting order(s)
ascending (bool or list of bool) – sort ascending vs. descending. Specify list for multiple sort orders. If this is a list of bools, must match the length of the
keys
.
- Return type
If no
keys
are specified the sorting is performed by the following ecCodes keys in the specified order:date
time
step
number
level
paramId
Here number is the ENS forecast member number.
If
keys
are specified (either as a list or a str) they define the sorting keys (they must be valid ecCodes keys).The optional
ascending
can specify the ascending/descending sorting direction.ascending
can be either a bool or a list of bool:if it is a str the sorting direction applies to all the
keys
if it is a list
keys
must also be a list with the same number of elements - the sorting directions apply to each sorting key specified.
The sorting direction can also be expressed by the optional
orders
: “>” means descending, while “<” means ascending order. It cannot be used together withascending
.orders
can be either a str or a list:if it is a str the sorting direction applies to all the
keys
if it is a list
keys
must also be a list with the same number of elements - the sorting directions apply to each sorting key specified.