libera_utils.io.netcdf.write_libera_data_product#

libera_utils.io.netcdf.write_libera_data_product(data_product_definition: str | CloudPath | Path | LiberaDataProductDefinition, data: dict[str, ndarray[Any, dtype[_ScalarType_co]]] | Dataset, output_path: str | CloudPath | Path, time_variable: str, dynamic_product_attributes: dict[str, Any] | None = None, strict: bool = True, add_archive_path_prefix: bool = False) LiberaDataProductFilename#

Write a Libera data product NetCDF4 file that conforms to data product definition requirements

Parameters:
  • data_product_definition (str | PathType | LiberaDataProductDefinition) – Path to the data product definition against which to verify conformance

  • data (dict[str, NDarray] | xr.Dataset) – Data mapping variable names to numpy data arrays or a fully formed L1A xarray Dataset.

  • output_path (str | PathType) – Base path (directory or S3 prefix) at which to write the product file

  • time_variable (str) – Name of variable that indicates time. This is used to generate the start and end time for the filename.

  • dynamic_product_attributes (dict[str, Any] | None) – Optional dictionary of additional global attributes to add to the data product file. Must conform to the data product definition.

  • strict (bool) – Default True. Raises an exception if the final Dataset doesn’t conform to the data product definition.

  • add_archive_path_prefix (bool) – Note: do not use this to write to a processing dropbox! L2 devs do not need this kwarg. Default False. If True, adds the archive path prefix to the output path when generating the full output path.

Returns:

Filename object containing the full path to the written NetCDF4 data product file.

Return type:

LiberaDataProductFilename