get_gridded_coord

function of dascore.io.utils source

get_gridded_coord(
    values ,
    units = None,
)-> ‘BaseCoord’

Return a stored coordinate array forced onto an even grid.

For axes the instrument samples on a fixed grid, where the stored values only restate that grid and any departure from it is representation noise. Such an array can jitter past the tolerance get_coord uses to recognize an even coordinate and leave a monotonic coord with no step.

The grid spans the smallest and largest stored values in the stored sample count, never a median step, so files stating the same span agree on every sample and merge.

Parameters

Parameter Description
values The stored coordinate values.
units Units to attach to the returned coordinate.

Examples

import numpy as np
from dascore.io.utils import get_gridded_coord
# an even grid restated in float32, as some formats store it
values = np.linspace(4000.0, 4009.9, 100, dtype=np.float32)
coord = get_gridded_coord(values.astype(np.float64), units="m")
float(round(coord.step, 4))
0.1