libera_utils.l1a.nom_hk_trim.find_obsid_runs#

libera_utils.l1a.nom_hk_trim.find_obsid_runs(nom_hk: Dataset, *, source: NomHkObsidSource | None = None) → list[tuple[ObsIdSpec, slice]]#

Detect contiguous trim-eligible ObsID runs in a NOM-HK Dataset.

Parameters:
  • nom_hk (xr.Dataset) – Decoded NOM-HK Dataset with a PACKET dimension.

  • source (NomHkObsidSource or None) – If set, only scan that ObsID field; otherwise scan all trim-eligible sources.

Returns:

Ordered list of runs. Each slice indexes PACKET.

Return type:

list of (ObsIdSpec, slice)

Raises:

ValueError – If nom_hk has no PACKET dimension, or no PACKET_ICIE_TIME or SRC_SEQ_CTR variable, or if SRC_SEQ_CTR repeats or steps backward between packets whose packet times are within packet_ordering.REORDER_WINDOW (10 s).

Notes

Run slices are positions on the PACKET axis, so they are contiguous acquisition only when the axis is in SRC_SEQ_CTR order, as parse_packets_to_l1a_dataset writes it. This raises when it is not.