get_coverage

method of dascore.core.spool.Spool source

get_coverage(
    self ,
    dim: str = time,
    tolerance: float = 1.5,
    group: str | collections.abc.Sequence[str, collections.abc.Sequence[str], None] = None,
    missing_dim: Literal[‘raise’, ‘drop’] = drop,
)-> ‘pd.DataFrame’

Return a dataframe summarizing how complete the spool is.

One row per group of related patches — same kind, dims signature, coordinate identity, units, and sampling rate, exactly as chunk groups them before it looks at continuity. Each row reports the extent the group spans along dim and how much of that extent holds data.

Parameters

Parameter Description
dim The dimension to measure along.
tolerance The maximum number of samples patches can be spaced and still
count as contiguous. Same meaning as chunk’s tolerance.
group Attributes which separate patches into unrelated groups.
Defaults to the config option patch_kind_attrs; sampling
and structural differences split groups too, so one
attribute value can span several rows. A value nobody
recorded conflicts with nothing, so a patch which never
stated the attribute joins the group that did.
missing_dim What to do with patches lacking dim: “drop” (the default)
excludes them, “raise” refuses.
Note

span is {dim}_max - {dim}_min, gap_total is the sum of the group’s gaps as get_gaps reports them, covered is the rest, and coverage is covered / span (1.0 when the span is zero, meaning a single sample). group_id matches the gap frame’s, so the two join on it.

Coverage is measured between patches, from the envelopes the index records; a hole inside a patch is not visible here. Nor is one in a group whose step is unknown, which reports no gaps and so counts as fully covered. Both are what chunk would make of the data, so a coverage of 1.0 says “nothing chunk would refuse to merge”, not “nothing missing”.

See Also

Spool.get_gaps

get_gap_edges finds the gaps inside one patch’s coordinate, which is a different question: this method reads the index and never loads data.

Examples

import numpy as np
from dascore.examples import random_spool

spool = random_spool(time_gap=np.timedelta64(1, "s"), length=3)
coverage = spool.get_coverage()
assert (coverage["coverage"] < 1).all()
assert (random_spool().get_coverage()["coverage"] == 1).all()