Skip to content
Snippets Groups Projects
Commit 044336be authored by Bert Palm's avatar Bert Palm 🎇
Browse files

Merge branch 'deprecate-roll' into 'develop'

rename roll to rolling

See merge request !662
parents d3e4f56c a252071a
No related branches found
No related tags found
3 merge requests!685Release 2.4,!684Release 2.4,!662rename roll to rolling
Pipeline #162772 passed with stages
in 9 minutes and 2 seconds
......@@ -13,6 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
- `Flags` supports slicing and column selection with `list` or a `pd.Index`
### Changed
- Deprecate `interpolate`, `linear` and `shift` in favor of `align`
- Depreacte `roll` in favor of `rolling`
- Rename `interplateInvalid` to `interpolate`
- Rename `interpolateIndex` to `align`
### Removed
......
......@@ -19,6 +19,61 @@ if TYPE_CHECKING:
class RollingMixin:
@register(mask=["field"], demask=[], squeeze=[])
def rolling(
self: "SaQC",
field: str,
window: Union[str, int],
func: Callable[[pd.Series], np.ndarray] = np.mean,
min_periods: int = 0,
center: bool = True,
**kwargs
) -> "SaQC":
"""
Calculate a rolling-window function on the data.
Note, that the data gets assigned the worst flag present in the original data.
Parameters
----------
field : str
The column to calculate on.
flags : saqc.Flags
Container to store quality flags to data.
window : {int, str}
The size of the window you want to roll with. If an integer is passed, the size
refers to the number of periods for every fitting window. If an offset string
is passed, the size refers to the total temporal extension. For regularly
sampled timeseries, the period number will be casted down to an odd number if
``center=True``.
func : Callable, default np.mean
Function to roll with.
min_periods : int, default 0
The minimum number of periods to get a valid value
center : bool, default True
If True, center the rolling window.
Returns
-------
saqc.SaQC
"""
self._data, self._flags = _roll(
data=self._data,
field=field,
flags=self._flags,
window=window,
func=func,
min_periods=min_periods,
center=center,
**kwargs,
)
return self
@register(mask=["field"], demask=[], squeeze=[])
def roll(
self: "SaQC",
......@@ -62,6 +117,14 @@ class RollingMixin:
-------
saqc.SaQC
"""
import warnings
warnings.warn(
"""The function `roll` was renamed to `rolling` and will be removed with version 3.0 of saqc
Please use `SaQC.rolling` with the same arguments, instead
""",
DeprecationWarning,
)
self._data, self._flags = _roll(
data=self._data,
field=field,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment