libera_utils.l1a.data_time_extractors.extract_data_time_range_from_dataset#
- libera_utils.l1a.data_time_extractors.extract_data_time_range_from_dataset(packet_ds: Dataset, apid: int) tuple[datetime, datetime] | None#
Extract the min/max science data time span from an already-parsed packet dataset.
extract_data_time_rangeis the file-taking wrapper around this.- Parameters:
packet_ds (xr.Dataset) – Single-APID packet dataset, as returned by
parse_packets_to_dataset.apid (int) – Application Process Identifier the dataset was parsed for.
- Returns:
(first_data_time, last_data_time)as timezone-aware UTC datetimes, orNonefor a WFOV dataset with noSOPpacket to recover an image time from.- Return type:
tuple[datetime, datetime] | None
- Raises:
DataTimeUndeterminedError – If the APID is not data-time indexed, or usable data times cannot be determined for a reason other than a missing in-window
SOP.