libera_utils.l1a.day_coverage.evaluate_day_coverage#

libera_utils.l1a.day_coverage.evaluate_day_coverage(intervals: list[tuple[datetime | None, datetime | None]], *, day: date, policy: DayCoveragePolicy, seam_tolerance: timedelta = datetime.timedelta(seconds=1)) → DayCoverageResult#

Evaluate L0 time-span coverage of the buffered day window [D - B, D + 1 + B].

Under FRACTION a day passes two checks: the spans that touch the window start by its left edge and end by its right edge (covers_window), and the spans cover at least policy.window_coverage_frac of the window (window_frac_ok). A gap counts the same against the fraction wherever it falls in the window.

Pairs with a None endpoint and inverted pairs (start > end) are ignored. A span whose start equals its end, such as a file holding one time, counts toward presence and toward reaching a window edge but adds nothing to the fraction.

Parameters:
  • intervals (list of tuple of datetime) – Effective L0 time ranges (data times preferred), timezone-aware.

  • day (datetime.date) – Applicable UTC calendar day.

  • policy (DayCoveragePolicy) – Completeness rule for the APID being assembled, get_packet_config(apid).day_coverage.

  • seam_tolerance (datetime.timedelta, optional) – Spacing between two spans that still counts as continuous, and the distance by which a span may fall short of a window edge and still reach it. Default DEFAULT_SEAM_TOLERANCE (1 s). Pass timedelta(0) to require exact abutment.

Returns:

The window fraction and both checks. Under PRESENCE both checks equal presence: whether any span overlaps the day window (overlaps_day_window()).

Return type:

DayCoverageResult

Raises:

TypeError – If an endpoint is timezone-naive.