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()get_coverage
get_coverage(
self ,
dim: str = time,
tolerance: float | pint.registry.Quantity | numpy.timedelta64[float, Quantity, timedelta64] = 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.
Each row describes one chunk compatibility group, its extent along dim, and the portion of that extent containing 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, or a quantity or timedelta stating that limit in the coordinate’s own units (eg 1 * s). Samemeaning as chunk’s tolerance.
|
| group |
Attributes which separate patches into unrelated groups. Defaults to the config option patch_kind_attrs; samplingand structural differences split groups too, so one attribute value can span several rows. A value nobody recorded is a value of its own, so a patch which never stated the attribute is not grouped with one which did. |
| missing_dim |
What to do with patches lacking dim: “drop” (the default)excludes them, “raise” refuses. |
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: a sample-count tolerance has nothing to scale there, so the group reports no gaps and counts as fully covered. An absolute tolerance does measure it. 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
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.