fill_gaps

method of dascore.core.spool.Spool source

fill_gaps(
    self ,
    *args ,
    fill_value: Any = nan,
    samples: bool = False,
    conflict: Literal[‘drop’, ‘raise’, ‘keep_first’] = raise,
    **kwargs ,
)-> ‘Self’

Fill the gaps within and between patches along a dimension.

Lazily joins patches, and each patch’s segments, across gaps up to the given size into one patch per stretch, filled as Patch.fill_gaps fills; wider gaps stay. A later chunk or cut joins across the filled gaps, loading only the files each output reaches (every file of its stretch under a conflict other than “raise”, whose attrs depend on them all).

Parameters

Parameter Description
*args, fill_value, samples, **kwargs As Patch.fill_gaps takes them; a
fill value the data cannot hold raises as a patch loads.
conflict Indicates how to handle attributes which hold conflicting values across
the patches being combined (eg data_type, data_units, custom attrs). A
missing value (None, NaN, ““) is a value like any other: it equals
another missing one and nothing else, so a patch which never stated an
attribute conflicts with one which did. History, the SEG-Y text header
and the ids are never compared. If”raise” (default) raise an
AttributeMergeError for
conflicting values. If “drop”, omit the conflicting attributes from the
output. If “keep_first”, keep the first patch’s value of each. The same
policy decides a non-dimensional coordinate on a dimension other than the
combined one which the patches hold differently, or which some patch
lacks: “keep_first” keeps the first patch’s coordinate and “drop” leaves it
out, each with a warning naming it.

Examples

import dascore as dc
spool = dc.get_example_spool("random_das", time_gap=1)
filled = spool.fill_gaps(time=2)  # gaps up to 2 s: one patch
chunks = filled.chunk(time=4)