split_gaps

function of dascore.proc.coords source

split_gaps(
    self: Patch ,
)-> ‘dc.Spool’

Split the patch into contiguous patches, as a spool holds it.

This is dc.spool([patch]): the patch splits at every boundary between a dimension’s evenly sampled runs and at every hole missing reports; irregular labels sharing no step stay one piece. Each output is a view of the patch’s data; a patch without holes comes back unchanged.

Parameters

Parameter Description
self The Patch object.

Examples

import numpy as np
import dascore as dc
from dascore.core.coords import concat_coords, get_coord

# A patch whose distance coordinate has a gap.
dist = concat_coords(
    get_coord(start=0.0, stop=10.0, step=1.0),
    get_coord(start=15.0, stop=25.0, step=1.0),
)
patch = dc.Patch(
    data=np.zeros((len(dist), 5)),
    coords={"distance": dist, "time": dc.to_datetime64(np.arange(5))},
    dims=("distance", "time"),
)
spool = patch.split_gaps()
assert len(spool) == 2