eoio.processors.interpolate.processor module#

eoio.processors.interpolate.processor#

Top-level interpolation processor.

This processor provides a single, stable user-facing interface (interpolate).

User config example#

processors = {
“interpolate”: {

“coords”: [“x_5000m”, “y_5000m”], “target_grid”: [“x_60m”, “y_60m”], “method”: “linear”, },

}

class eoio.processors.interpolate.processor.Interpolate(params: Dict[str, Any] | None = None, context: Dict[str, Any] | None = None)[source]#

Bases: BaseProcessor

Interpolate measurement variables in a dataset to a new coordinate grid.

Processor parameters#

The following parameters can be provided in the params dict:

param coords:

List of coordinate names to interpolate along (e.g. ["x", "y"]).

param target_grid:

List of target coordinate values to interpolate to. If str, must be the name of an existing coordinate in the dataset (e.g. "x_60m"). If xr.DataArray, new coord name will be set to name of DataArray. If other (np.Array, list), coord name will be unchanged (e.g. "x_5000m" or "x_5000m_interp" depending on value of ‘inplace’).

param data_vars:

List of variable names to interpolate. If omitted, all variables with any of the interpolation coordinates as a dimension will be interpolated.

param method:

Interpolation method (e.g. "linear", "nearest", etc.). Must be supported by the underlying interpolation implementation (e.g. xarray.interp()).

param inplace:

Bool, if False, new interpolated variables are added to the dataset with the suffix ‘_interp’ (e.g. ‘B02_interp’). If True, original variables are replaced by interpolated ones. Default is False.

param on_missing:

Behaviour if required metadata for conversion is missing. Supported values are "error" (default, if omitted) or "skip".

Notes

  • This processor is intended to run after reading.

name = 'interpolate'#
run(ds: Dataset) Dataset[source]#

Run interpolation on the dataset.

Parameters:

ds – Input dataset.

Returns:

Output dataset with interpolated variables.

class eoio.processors.interpolate.processor.InterpolateConfig(coords: Sequence[str], target_grid: Sequence, data_vars: Sequence[str] | None = None, method: str = 'linear', inplace: bool | None = False, on_missing: str = 'error')[source]#

Bases: object

Parameters for the interpolate processor.

coords: Sequence[str]#
data_vars: Sequence[str] | None = None#
inplace: bool | None = False#
method: str = 'linear'#
on_missing: str = 'error'#
target_grid: Sequence#