postgkyl.sort¶
- postgkyl.sort(*datasets, reverse=False)¶
Reorder datasets by the natural/numeric sort of their source filename.
Fixes the shell-glob/lexicographic-sort trap where
field_10.gkylsorts beforefield_2.gkyl: digit runs embedded in the filename are compared as integers rather than character-by-character, so frame files come out in increasing frame order regardless of digit-count padding (seenumerics.natural_sort_key).Accepts
sort(a, b)orsort([a, b])(flattened viagdatastate.flatten_datasets). No dataset is copied or mutated – only the returned list’s order differs from the input.- Parameters:
*datasets – the datasets to reorder, or lists/groups thereof.
reverse – sort in decreasing order instead of increasing.
- Returns:
The same datasets, reordered by their source filename’s natural sort key.