concat_coords

function of dascore.core.coords source

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

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 recorded as a segment boundary. The result is a CoordSegmented unless the inputs fuse into a single segment, in which case that coordinate is returned directly. Use simplify on the result for tolerance-bounded gap absorption.

Parameters

Parameter Description
*coords Coordinates to concatenate. Each must be evenly sampled
(CoordRange), monotonic
(CoordMonotonicArray),
or already segmented. Inputs are ordered by their envelopes; 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)