libera_utils.l1a.packet_slicing.slice_l1a_dataset_to_time_window#
- libera_utils.l1a.packet_slicing.slice_l1a_dataset_to_time_window(dataset: Dataset, t0: datetime64, t1: datetime64) Dataset#
Subset a decoded L1A Dataset to the packets covering the time window
[t0, t1].When the Dataset has sample axes, a packet is selected if any of its samples falls inside the window; the union across sample groups is taken so no group loses data another group kept. When the Dataset has no sample axes (e.g. PEC-SW-STAT), the window is applied to its packet time coordinate, named by its APID’s packet configuration, instead.
On
CAMERA_TIME, an image in the window keeps all of its packets, SOP through EOP. A packet in no image (PACKET_IMAGE_ID == -1) has no data time and is not selected.Whole packets always survive, so a selected packet contributes all of its samples even where some of them fall outside the window.
- Parameters:
dataset (xr.Dataset) – Decoded L1A Dataset with a
PACKETdimension.t0 (np.datetime64) – Window start time (inclusive).
t1 (np.datetime64) – Window end time (inclusive).
- Returns:
Time-windowed Dataset.
- Return type:
xr.Dataset
- Raises:
ValueError – As
data_time_axes()raises it, or ifdatasethas aCAMERA_TIMEaxis but noPACKET_IMAGE_ID.