function of dascore.proc.coords source

    patch: Patch ,
    *coords ,
    reverse = False,

Snap coordinates to evenly spaced samples.

This ensures all of the specified coordinates are evenly spaced and monotonic. First, the patch is sorted along specified coordinates, then coordinates are assumed evenly-sampled from their min to max value. Doing this can introduce some error since the coordinate labels are moved and the data (apart from the sorting) are left unchanged. Consider using interpolate for a more expensive but more accurate linear interpolation.


Parameter Description
*coords Used to specify the dimension names to convert to CoordRanges. If not
specified convert all dimensional coordinates.
reverse If True, reverse the sorting of the coordinates.


import dascore as dc
# get an example patch which has unevenly sampled coords time, distance
patch = dc.get_example_patch("wacky_dim_coords_patch")
# snap time dimension
time_snap = patch.snap_coords("time")
# snap the distance dimension
dist_snap = patch.snap_coords("distance")