libera_utils.l1a.day_window.trim_l1a_to_day_window#

libera_utils.l1a.day_window.trim_l1a_to_day_window(dataset: Dataset, *, day: date) → Dataset#

Trim a decoded L1A dataset to the packets inside the closed day window of day.

The window is [D − DAY_BUFFER, D + 1 + DAY_BUFFER] (day_bounds()); selection is slice_l1a_dataset_to_time_window()’s. Dataset attributes are carried over unchanged.

Parameters:
  • dataset (xr.Dataset) – Decoded L1A dataset with a PACKET dimension.

  • day (datetime.date) – Applicable UTC calendar day.

Returns:

Trimmed dataset; empty along PACKET when nothing falls in the window.

Return type:

xr.Dataset

Raises:

ValueError – As slice_l1a_dataset_to_time_window() raises it.