libera_utils.l1a.packets.drop_implausible_telemetry_times#

libera_utils.l1a.packets.drop_implausible_telemetry_times(times_us: ndarray, *, context: str) → ndarray#

Filter out packet/sample times outside the plausible telemetry window.

The window is MIN_VALID_TELEMETRY_TIME to MAX_VALID_TELEMETRY_TIME from config. Both are fixed dates, not offsets from now, so a span written to File Metadata does not depend on when extraction ran; the ceiling admits simulated-clock captures running at a mission-era epoch. A clock that has not yet received its first time-sync command reads out a near-zero day/second counter, decoding to just after CCSDS_EPOCH (1958-01-01), and one such packet stretches a min()/max() span across ~68 years.

A time exactly at the floor is dropped. NaT is dropped explicitly, since it compares false against both bounds.

Parameters:
  • times_us (np.ndarray) – Array of datetime64[us] packet or sample times.

  • context (str) – Description of what is being processed (APID/file), used in the warning log and in the error raised if nothing remains.

Returns:

times_us with any implausible entries removed.

Return type:

np.ndarray

Raises:

ValueError – If no times remain after filtering.