ecoscope.analysis.smoothing#
Module Contents#
- class ecoscope.analysis.smoothing.SmoothingConfig#
Configuration for data smoothing.
Attributes:#
- methodLiteral[“spline”]
The smoothing method to apply. Currently supports “spline”.
- y_minfloat, optional
The minimum value to clamp smoothed values to. Useful for data like precipitation where values should not go below zero.
- y_maxfloat, optional
The maximum value to clamp smoothed values to.
- resolutionint, optional
The resolution multiplier for interpolation points. The number of output points will be len(x) * resolution. Default is 10.
- degreeint, optional
The degree of the spline. Default is 3 (cubic spline). - 1: Linear interpolation - 2: Quadratic spline - 3: Cubic spline (recommended) - 4, 5: Higher degree (smoother but may oscillate more)
- method: Literal['spline']#
- y_min: float | None = None#
- y_max: float | None = None#
- resolution: int = 10#
- degree: int = 3#
- ecoscope.analysis.smoothing.apply_smoothing(x, y, config)#
Apply smoothing to x, y data and return smoothed values.
- Parameters:
x (np.ndarray) – The x values
y (np.ndarray) – The y values
config (SmoothingConfig) – The smoothing configuration
- Returns:
The smoothed (x, y) values
- Return type:
tuple[np.ndarray, np.ndarray]