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")snap_coords
snap_coords(
patch: Patch ,
*coords ,
reverse: bool = False,
)-> ‘PatchType’
Snap coordinates to evenly spaced samples.
Sorts each specified coordinate, then replaces its labels with evenly spaced values between its endpoints in the selected sort direction. Data remain unchanged after sorting, so snapping can shift labels. Use interpolate when linear interpolation is preferable.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch whose coordinates should be snapped. |
| *coords | Dimensions to snap. By default, snap every dimensional coordinate. |
| reverse | If True, reverse the sorting of the coordinates. |