ecoscope.analysis.smoothing =========================== .. py:module:: ecoscope.analysis.smoothing Module Contents --------------- .. py:class:: SmoothingConfig Configuration for data smoothing. Attributes: ---------- method : Literal["spline"] The smoothing method to apply. Currently supports "spline". y_min : float, optional The minimum value to clamp smoothed values to. Useful for data like precipitation where values should not go below zero. y_max : float, optional The maximum value to clamp smoothed values to. resolution : int, optional The resolution multiplier for interpolation points. The number of output points will be len(x) * resolution. Default is 10. degree : int, 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) .. py:attribute:: method :type: Literal['spline'] .. py:attribute:: y_min :type: float | None :value: None .. py:attribute:: y_max :type: float | None :value: None .. py:attribute:: resolution :type: int :value: 10 .. py:attribute:: degree :type: int :value: 3 .. py:function:: apply_smoothing(x, y, config) Apply smoothing to x, y data and return smoothed values. :param x: The x values :type x: np.ndarray :param y: The y values :type y: np.ndarray :param config: The smoothing configuration :type config: SmoothingConfig :returns: The smoothed (x, y) values :rtype: tuple[np.ndarray, np.ndarray]