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,
on_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 bounding the excess over one sample in the coordinate’s own units (eg 1 * s). Same meaning 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. |
| on_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 from the envelopes the index records for each row. A hole is not visible 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. Gaps and coverage alike are what chunk would make of the data with a fill_value, so a coverage of 1.0 says “nothing chunk would refuse to fill”, not “nothing missing”.
See Also
get_gap_edges finds the gaps in the values of a coordinate already loaded; this method reads only the index and never loads data.