concat_coords

function of dascore.core.coords source

concat_coords(
    *coords ,
    units = None,
)-> ‘NumericCoord’

Concatenate monotonic coordinates into a single coordinate.

This operation is truth-preserving: no value is ever altered, and every boundary between inputs that does not continue exactly is kept as a boundary between segments. Segments say where gaps are, never what the labels are, so equal labels make equal coordinates however split; Patch.fill_gaps and Patch.split_gaps act on the gaps.

Parameters

Parameter Description
*coords Coordinates to concatenate. Each must be numeric and monotonic.
Inputs are ordered by their envelopes, or, where every input holds
one sample, by the order they are given in; they must share dtype
kind, units, and sort direction, and must not overlap.
units If provided, set (not convert) these units on the output.

Examples

from dascore.core.coords import concat_coords, get_coord

c1 = get_coord(start=0.0, stop=10.0, step=1.0)
c2 = get_coord(start=15.0, stop=25.0, step=1.0)
coord = concat_coords(c1, c2)
assert len(coord) == len(c1) + len(c2)
assert coord.runs_count == 2 and coord.step is None
assert coord == get_coord(data=coord.values)