Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
044336be
Commit
044336be
authored
2 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Plain Diff
Merge branch 'deprecate-roll' into 'develop'
rename roll to rolling See merge request
!662
parents
d3e4f56c
a252071a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!685
Release 2.4
,
!684
Release 2.4
,
!662
rename roll to rolling
Pipeline
#162772
passed with stages
in 9 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
saqc/funcs/rolling.py
+63
-0
63 additions, 0 deletions
saqc/funcs/rolling.py
with
64 additions
and
0 deletions
CHANGELOG.md
+
1
−
0
View file @
044336be
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
saqc/funcs/rolling.py
+
63
−
0
View file @
044336be
...
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment