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
9a1d46df
Commit
9a1d46df
authored
4 years ago
by
David Schäfer
Browse files
Options
Downloads
Plain Diff
Merge branch 'constants' into 'develop'
constants: type hints See merge request
!198
parents
81a891d2
055f70ff
Branches
dependabot/pip/sphinx-autodoc-typehints-2.0.0
No related tags found
1 merge request
!198
constants: type hints
Pipeline
#14405
passed with stages
in 13 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/constants.py
+10
-4
10 additions, 4 deletions
saqc/funcs/constants.py
with
10 additions
and
4 deletions
saqc/funcs/constants.py
+
10
−
4
View file @
9a1d46df
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from
typing
import
Tuple
import
numpy
as
np
import
pandas
as
pd
from
dios
import
DictOfSeries
from
saqc.core.register
import
register
from
saqc.flagger.baseflagger
import
BaseFlagger
from
saqc.lib.ts_operators
import
varQC
from
saqc.lib.tools
import
retrieveTrustworthyOriginal
,
customRoller
@register
(
masking
=
'
field
'
)
def
flagConstants
(
data
,
field
,
flagger
,
thresh
,
window
,
**
kwargs
):
def
flagConstants
(
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
thresh
:
float
,
window
:
str
,
**
kwargs
)
->
Tuple
[
DictOfSeries
,
BaseFlagger
]
:
"""
This functions flags plateaus/series of constant values of length `window` if
their maximum total change is smaller than thresh.
...
...
@@ -66,8 +71,10 @@ def flagConstants(data, field, flagger, thresh, window, **kwargs):
@register
(
masking
=
'
field
'
)
def
flagByVariance
(
data
,
field
,
flagger
,
window
=
"
12h
"
,
thresh
=
0.0005
,
max_missing
=
None
,
max_consec_missing
=
None
,
**
kwargs
):
data
:
DictOfSeries
,
field
:
str
,
flagger
:
BaseFlagger
,
window
:
str
=
"
12h
"
,
thresh
:
float
=
0.0005
,
max_missing
:
int
=
None
,
max_consec_missing
:
int
=
None
,
**
kwargs
)
->
Tuple
[
DictOfSeries
,
BaseFlagger
]:
"""
Function flags plateaus/series of constant values. Any interval of values y(t),..y(t+n) is flagged, if:
...
...
@@ -111,7 +118,6 @@ def flagByVariance(
max_missing
=
np
.
inf
if
max_consec_missing
is
None
:
max_consec_missing
=
np
.
inf
min_periods
=
int
(
np
.
ceil
(
pd
.
Timedelta
(
window
)
/
pd
.
Timedelta
(
data_rate
)))
plateaus
=
dataseries
.
rolling
(
window
=
window
,
min_periods
=
min_periods
).
apply
(
...
...
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