eoio.processors.resample_wavelength.processor module#
eoio.processors.resample_wavelength.processor#
Top-level wavelength resampling processor.
Resamples spectral variables, each on its own wavelength dimension (wavelength_olci,
wavelength_floris, … as produced by the FLEX reader), onto one common wavelength grid so
they can be combined or compared.
User config example#
- processors= {
- “resample_wavelength”: {
“target_wavelength”: {“min”: 500, “max”: 780, “step”: 1}, “data_vars”: [“floris_apparent_reflectance”, “olci_apparent_reflectance”], “method”: “linear”,
},
}
- class eoio.processors.resample_wavelength.processor.ResampleWavelength(params: Dict[str, Any] | None = None, context: Dict[str, Any] | None = None)[source]#
Bases:
BaseProcessorResample spectral variables onto a common wavelength grid.
Each selected variable is interpolated along its own
wavelength_*dimension onto the target wavelengths, giving variables that share onewavelengthdimension. Target wavelengths outside the range of a variable’s source grid are set to NaN (no extrapolation).Obsarray uncertainty components (
<var>_uncertainty) of resampled variables are resampled with them and re-registered against the resampled variable, keeping their error-correlation definition with the wavelength dimension renamed.Processor parameters#
The following parameters can be provided in the
paramsdict:- param target_wavelength:
Required. Target wavelengths in nm, either a list/array, or a dict
{"min", "max", "step"}(maxinclusive).- param data_vars:
Optional list of variables to resample. If omitted, all variables with a
wavelength_*dimension are resampled.- param method:
Interpolation method (
"linear","nearest","cubic", …), as forxarray.interp. Default"linear".- param dim_name:
Name of the new common wavelength dimension. Default
"wavelength".- param inplace:
If False (default) resampled variables are added with the suffix
_resampled(e.g.floris_apparent_reflectance_resampled). If True they replace the originals.- param drop_original:
If True, drop the originals (and their now-unneeded wavelength coordinates) after resampling. No-op when
inplaceis True. Default False.- param on_missing:
Behaviour if a requested variable is missing or has no wavelength dimension:
"error"(default) or"skip".
Notes
This processor is intended to run after reading.
- name = 'resample_wavelength'#
- class eoio.processors.resample_wavelength.processor.ResampleWavelengthConfig(target_wavelength: ndarray, data_vars: Sequence[str] | None = None, method: str = 'linear', dim_name: str = 'wavelength', inplace: bool = False, drop_original: bool = False, on_missing: str = 'error')[source]#
Bases:
objectParameters for the resample_wavelength processor.
- data_vars: Sequence[str] | None = None#
- dim_name: str = 'wavelength'#
- drop_original: bool = False#
- inplace: bool = False#
- method: str = 'linear'#
- on_missing: str = 'error'#
- target_wavelength: ndarray#
- eoio.processors.resample_wavelength.processor.WAVELENGTH_DIM_PREFIX = 'wavelength_'#
prefix identifying a source wavelength dimension