libera_utils.kernel_maker.create_kernel_dataframe_from_l1a_netcdf#

libera_utils.kernel_maker.create_kernel_dataframe_from_l1a_netcdf(netcdf_path: CloudPath | Path, apid: int, sample_group_name: str) tuple[DataFrame, tuple[datetime, datetime]]#

Create a Curryer-compatible kernel DataFrame from an L1A NetCDF file.

This convenience function opens an L1A NetCDF file and extracts sample group data for SPICE kernel generation. It wraps create_kernel_dataframe_from_l1a() to provide a simpler interface when working with NetCDF files.

Parameters:
  • netcdf_path (filenaming.PathType) – Path to the L1A NetCDF file (local or S3). The file should be created by parse_packets_to_l1a_dataset() or equivalent processing.

  • 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.

Returns:

A tuple containing: - DataFrame with ET time column and sample data fields - UTC time range tuple (start, end) for the data

Return type:

tuple[pd.DataFrame, tuple[datetime, datetime]]

Raises:
  • FileNotFoundError – If the NetCDF file does not exist at the specified path

  • ValueError – If the file cannot be opened as a valid NetCDF file, or if validation errors occur in create_kernel_dataframe_from_l1a()

Examples

>>> from libera_utils.constants import LiberaApid
>>> df, utc_range = create_kernel_dataframe_from_l1a_netcdf(
...     netcdf_path="path/to/l1a_file.nc",
...     apid=LiberaApid.jpss_sc_pos,
...     sample_group_name="ADGPS"
... )