libera_utils.l1a.ground_ccsds.scan_ground_ccsds_file#
- libera_utils.l1a.ground_ccsds.scan_ground_ccsds_file(packet_file: PathLike | str, *, apid: int | None = None, skip_header_bytes: int = 0) GroundCcsdsTimeSpan | None#
Scan one demuxed ground CCSDS file for its packet and science data time spans.
A data-time-indexed APID also gets science data times via
extract_data_time_range_from_dataset. When those cannot be determined the packet-time span is still returned, withfirst_data_time/last_data_timeNoneanddegraded_reasonset.- Parameters:
- Returns:
Time spans for File Metadata ingest, or
Noneif no packet-time span can be produced at all: the APID is not aLiberaApidmember, has no packet configuration, the file does not parse for a reason other than resource exhaustion, holds no packets for the APID, or every packet time is implausible. The reason is logged. No searchable metadata is possible for such a file, so a caller should surface theNoneas its own error.- Return type:
GroundCcsdsTimeSpan | None
- Raises:
ValueError – If
apidis omitted and the basename is not a valid ground CCSDS filename.MemoryError – If memory runs out while the file is read or parsed. It is not wrapped.
OSError – If reading the file, including downloading a cloud file to the local cache, fails with
ENOSPC,EDQUOT,EMFILEorENFILE(seelibera_utils.io.smart_open.is_resource_exhaustion). It is not wrapped.