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:
BaseProcessorInterpolate measurement variables in a dataset to a new coordinate grid.
Processor parameters#
The following parameters can be provided in the
paramsdict:- 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. Either way the source-grid coordinates (those named in
coords) are left in place, so the same grid can feed severalinterpolatesteps in one pipeline.- param on_missing:
Behaviour if required metadata for conversion is missing. Supported values are
"error"(default, if omitted) or"skip".- param drop_original:
Bool, if True, drop the source variable(s) (the ones named in
data_vars, or every variable that had the interpolation coords as a dimension ifdata_varswas omitted) after producing the interpolated copy. Only meaningful wheninplaceis False – wheninplaceis True there’s no separate original left to drop, so this is a no-op in that case. Default is False, matchingStackCubes’sdrop_originalsdefault.Be careful when the same source variable is interpolated to multiple target grids across several
interpolatesteps in one pipeline (e.g. a shared solar angle interpolated onto three different band resolutions): only setdrop_original=Trueon the last such step, since dropping the source after the first would leave nothing for the remaining steps to interpolate from.
Notes
This processor is intended to run after reading.
- name = 'interpolate'#
- 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', drop_original: bool = False)[source]#
Bases:
objectParameters for the interpolate processor.
- coords: Sequence[str]#
- data_vars: Sequence[str] | None = None#
- drop_original: bool = False#
- inplace: bool | None = False#
- method: str = 'linear'#
- on_missing: str = 'error'#
- target_grid: Sequence#