eoio.readers.flex.data_io module#

eoio.readers.flex.data_io#

Data I/O for FLEX L2 FLXSYN products.

Functions#

read_grid(path)

Read the product grid from the global attributes and the ancillary group.

read_wavelengths(path)

Read the wavelength coordinate for every spectral dimension, as stored in the product.

read_dataset(path, include_vars, grid, ...)

Read the requested variables (and their uncertainty partners, if named) into a dataset.

register_uncertainties(ds)

Register every <var>_uncertainty variable as an obsarray uncertainty component of <var>.

err_corr_for(dims)

Assumed error-correlation structure of an uncertainty component.

eoio.readers.flex.data_io.err_corr_for(dims: Iterable[str]) → List[dict][source]#

Assumed error-correlation structure of an uncertainty component.

PLACEHOLDER: the product documents no correlation model. Until one is confirmed, uncertainties are assumed random across the spatial dimensions and fully systematic along any spectral dimension.

Parameters:

dims – dimensions of the uncertainty variable.

Returns:

obsarray err_corr definition.

eoio.readers.flex.data_io.read_dataset(path: str, include_vars: Iterable[str], grid: FlexGrid, wavelengths: Dict[str, DataArray], subset: FLEXSubset | None = None, chunks: Dict[str, int] | None = None) → Dataset[source]#

Read the requested variables (and their uncertainty partners, if named) into a dataset.

Dimensions are renamed to y/x plus one named dimension per spectral/trailing axis, packed integers are unpacked, and coordinates (x, y, latitude, longitude, wavelengths, labels) are attached. Subsetting is applied before data are loaded.

Parameters:
  • path – path to the FLEX product.

  • include_vars – variable names to read, including any *_uncertainty partners.

  • grid – product grid.

  • wavelengths – wavelength coordinates, as returned by read_wavelengths().

  • subset – resolved subset, or None for the full product.

  • chunks – dask chunk sizes along y/x. If given, variables stay lazy (dask-backed, file left open) after subsetting; otherwise they are loaded into memory.

Returns:

dataset with the requested variables.

eoio.readers.flex.data_io.read_grid(path: str) → FlexGrid[source]#

Read the product grid from the global attributes and the ancillary group.

Parameters:

path – path to the FLEX product.

Returns:

the product grid.

eoio.readers.flex.data_io.read_wavelengths(path: str) → Dict[str, DataArray][source]#

Read the wavelength coordinate for every spectral dimension, as stored in the product.

FLORIS wavelengths are stored per across-track sample (across_track x channel), but only the first sample is populated in the products seen so far. They are collapsed to a single wavelength vector (mean over the populated samples); a warning is raised if populated samples differ, since a single vector then no longer describes the product. This is provisional: a spectral smile may require per-row wavelengths, to be revisited with real products (it is expected to be corrected in L1).

Parameters:

path – path to the FLEX product.

Returns:

mapping from dimension name (e.g. "wavelength_olci") to a 1-D wavelength DataArray in nm.

eoio.readers.flex.data_io.register_uncertainties(ds: Dataset) → Dataset[source]#

Register every <var>_uncertainty variable as an obsarray uncertainty component of <var>.

This makes them discoverable via ds.unc[var] with machine-readable error-correlation metadata (see err_corr_for() for the assumptions made).

Parameters:

ds – dataset as returned by read_dataset().

Returns:

dataset with uncertainty variables registered.