libera_utils.kernel_maker.create_kernel_dataframe_from_l1a#
- libera_utils.kernel_maker.create_kernel_dataframe_from_l1a(l1a_dataset: Dataset, apid: int, sample_group_name: str) tuple[DataFrame, tuple[datetime, datetime]]#
Create a Curryer-compatible kernel DataFrame from an L1A Dataset.
This function extracts sample group data from an L1A Dataset and converts it into a pandas DataFrame suitable for SPICE kernel generation with Curryer. The time coordinates are converted from datetime64 to SPICE Ephemeris Time (ET).
- Parameters:
l1a_dataset (xr.Dataset) – L1A Dataset containing sample group data with time coordinates. Should be created by parse_packets_to_l1a_dataset() or read from an L1A NetCDF file.
apid (int) – The APID (Application Process Identifier) that identifies which packet configuration to use for extracting sample group metadata. Use LiberaApid enum values.
sample_group_name (str) – The name of the sample group to extract from the L1A dataset. This is used to infer the time dimension and data fields.
- Returns:
A tuple containing: - DataFrame with ET time column and sample data fields - UTC time range tuple (start, end) for the data
- Return type:
- Raises:
ValueError – If the APID has multiple sample groups and sample_group_name is not provided, or if the specified sample_group_name is not found in the packet configuration
KeyError – If required fields are missing from the L1A dataset
TypeError – If l1a_dataset is not an xarray.Dataset