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 | None[float, Quantity, timedelta64, None] = None,
max_shift: float | None[float, None] = None,
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 |
Off by default. A number joins seams up to that many steps wide; a quantity or timedelta (eg 1 * s) joins seams up tothat width in the coordinate’s own units. Same meaning as chunk’s tolerance.
|
| max_shift |
How far, as a fraction of a step, a seam may be from one step wide and still join; None means dascore.config.max_shift.
|
| 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). missing sums the samples the group’s gaps miss (NaN where a gap’s step is unknown). 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, at the seams chunk with the same arguments splits at, so a coverage of 1.0 says “chunk joins all of it”, 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.