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
2f824cf6
Commit
2f824cf6
authored
3 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
..
parent
61395f93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
6 merge requests
!685
Release 2.4
,
!684
Release 2.4
,
!567
Release 2.2.1
,
!566
Release 2.2
,
!501
Release 2.1
,
!429
Global kwarg docs
Pipeline
#71296
passed with stage
in 1 minute and 37 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sphinxdoc/documentation/GlobalKeywords.rst
+106
-0
106 additions, 0 deletions
sphinxdoc/documentation/GlobalKeywords.rst
sphinxdoc/index.rst
+1
-0
1 addition, 0 deletions
sphinxdoc/index.rst
with
107 additions
and
0 deletions
sphinxdoc/documentation/GlobalKeywords.rst
0 → 100644
+
106
−
0
View file @
2f824cf6
.. SPDX-FileCopyrightText: 2021 Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
..
.. SPDX-License-Identifier: GPL-3.0-or-later
GlobalKeywords
==============
1. `label`_
* `label Example Usage`_
2. `dfilter`_
3. `flag`_
Label
-----
.. plot::
:context: close-figs
:include-source: False
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import saqc
noise = np.random.normal(0, 1, 200)
data = pd.Series(noise, index=pd.date_range('2020','2021',periods=200), name='data')
data.iloc[20] = 16
data.iloc[100] = -17
data.iloc[160:180] = data.iloc[160:180] - 13
qc = saqc.SaQC(data)
The `label` keyword can be passed with any function call and serves as label to be plotted by a subsequent
call to :py:meth:`saqc.SaQC.plot`.
It is especially useful for enriching figures with custom context information and for making results from
different function calls distinguishable with respect to their purpose and parameterisation.
Check out the following examples.
We are generating the following example data and plot it:
.. doctest:: exampleLabel
>>> import pandas as pd
>>> import numpy as np
>>> noise = np.random.normal(0, 1, 200) # some normally distributed noise
>>> data = pd.Series(noise, index=pd.date_range('2020','2021',periods=200), name='data') # index the noise with some dates
>>> data.iloc[20] = 16 # add some artificial anomalies:
>>> data.iloc[100] = -17
>>> data.iloc[160:180] = data.iloc[160:180] - 13
>>> qc = saqc.SaQC(data)
>>> qc.plot('data') #doctest:+SKIP
.. plot::
:context: close-figs
:include-source: False
qc.plot('data')
Now we apply some flagging functions to mark anomalies, at first, without usage of the `label` keyword
.. doctest:: exampleLabel
>>> qc = qc.flagRange('data', max=15)
>>> qc = qc.flagRange('data', min=-16)
>>> qc = qc.flagConstants('data', window='2D', thresh=0)
>>> qc = qc.flagManual('data', mdata=pd.Series('2020-05', index=pd.DatetimeIndex(['2020-03'])))
>>> qc.plot('data') # doctest:+SKIP
.. plot::
:context: close-figs
:include-source: False
qc = qc.flagRange('data', max=15)
qc = qc.flagRange('data', min=-16)
qc = qc.flagConstants('data', window='2D', thresh=0)
qc = qc.flagManual('data', mdata=pd.Series('2020-05', index=pd.DatetimeIndex(['2020-03'])))
qc.plot('data')
In the above plot, one might want to discern the two results from the call to :py:meth:`saqc.SaQC.flagRange` with
respect to the parameters they where called, also, one might want to give some hints about what is the context of
the flags "manually" determined by the call to :py:meth:`saqc.SaQC.flagManual`. Lets repeat the procedure and
enrich the call with this informations by making use of the label keyword:
Label Example Usage
^^^^^^^^^^^^^^^^^^^
.. doctest:: exampleLabel
>>> qc = saqc.SaQC(data)
>>> qc = qc.flagRange('data', max=15, label='values < 15')
>>> qc = qc.flagRange('data', min=-16, label='values > -16')
>>> qc = qc.flagConstants('data', window='2D', thresh=0, label='values constant longer than 2 days')
>>> qc = qc.flagManual('data', mdata=pd.Series('2020-05', index=pd.DatetimeIndex(['2020-03'])), label='values collected while sensor maintenance')
>>> qc.plot('data') # doctest:+SKIP
.. plot::
:context: close-figs
:include-source: False
qc = saqc.SaQC(data)
qc = qc.flagRange('data', max=15, label='values < 15')
qc = qc.flagRange('data', min=-16, label='values > -16')
qc = qc.flagConstants('data', window='2D', thresh=0, label='values constant longer than 2 days')
qc = qc.flagManual('data', mdata=pd.Series('2020-05', index=pd.DatetimeIndex(['2020-03'])), label='values collected while sensor maintenance')
qc.plot('data')
This diff is collapsed.
Click to expand it.
sphinxdoc/index.rst
+
1
−
0
View file @
2f824cf6
...
...
@@ -41,6 +41,7 @@ Getting Started
documentation/FlaggingTranslation
documentation/GenericFunctions
documentation/SourceTarget
documentation/GlobalKeywords
.. toctree::
...
...
This diff is collapsed.
Click to expand it.
David Schäfer
@schaefed
mentioned in commit
63b55c6d
·
2 years ago
mentioned in commit
63b55c6d
mentioned in commit 63b55c6d7dadb0e612b23a897f292d5ffc14cb52
Toggle commit list
David Schäfer
@schaefed
mentioned in commit
684dc8a0
·
2 years ago
mentioned in commit
684dc8a0
mentioned in commit 684dc8a0515470d644fc85fee95d07661c8dd572
Toggle commit list
David Schäfer
@schaefed
mentioned in commit
8f7a90e4
·
1 year ago
mentioned in commit
8f7a90e4
mentioned in commit 8f7a90e4aed61c79a9dc8d67541a46beba0907e8
Toggle commit list
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