function of dascore.proc.coords source

    patch: Patch ,
    *coords ,
    reverse = False,

Sort one or more coordinates.

Sorts the specified coordinates in the patch. An error will be raised if the coordinates have overlapping dimensions since it may not be possible to sort each. An error is also raised in any of the coordinates are multidimensional.


Parameter Description
*coords Used to specify the coordinates to sort.
reverse If True, sort in descending order, else ascending.


import dascore as dc
# get an example patch which has unevenly sampled coords time, distance
patch = dc.get_example_patch("wacky_dim_coords_patch")
# sort time coordinate (dimension) in ascending order
time_snap = patch.sort_coords("time")
assert time_snap.coords.coord_map['time'].sorted
# sort distance coordinate (dimension) in descending order
dist_snap = patch.sort_coords("distance", reverse=True)
assert dist_snap.coords.coord_map['distance'].reverse_sorted