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
7a492375
Commit
7a492375
authored
5 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
readded plotting
parent
5a1df7c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
saqc/core/core.py
+6
-7
6 additions, 7 deletions
saqc/core/core.py
saqc/lib/plotting.py
+19
-1
19 additions, 1 deletion
saqc/lib/plotting.py
test/core/test_core.py
+2
-2
2 additions, 2 deletions
test/core/test_core.py
with
27 additions
and
10 deletions
saqc/core/core.py
+
6
−
7
View file @
7a492375
...
...
@@ -7,7 +7,7 @@ import pandas as pd
from
.reader
import
readConfig
,
prepareConfig
,
checkConfig
from
.config
import
Fields
from
.evaluator
import
evalExpression
from
..lib.plotting
import
plot
from
..lib.plotting
import
plot
_hook
,
plotall_hook
from
..flagger
import
BaseFlagger
,
CategoricalBaseFlagger
,
SimpleFlagger
,
DmpFlagger
...
...
@@ -104,20 +104,19 @@ def runner(metafname, flagger, data, flags=None, nodata=np.nan):
fchunk
=
flags
.
loc
[
start_date
:
end_date
]
dchunk
,
fchunk
=
evalExpression
(
dchunk
,
f
fchunk
=
evalExpression
(
flag_test
,
data
=
dchunk
,
flags
=
fchunk
.
copy
(),
field
=
varname
,
flagger
=
flagger
,
nodata
=
nodata
)
data
.
loc
[
start_date
:
end_date
]
=
dchunk
flags
.
loc
[
start_date
:
end_date
]
=
fchunk
.
squeeze
()
flags
.
loc
[
start_date
:
end_date
]
=
ffchunk
.
squeeze
()
plot_hook
(
dchunk
,
fchunk
,
ffchunk
,
varname
,
configrow
[
Fields
.
PLOT
],
flag_test
,
flagger
)
# NOTE: this method should be removed
flagger
.
nextTest
()
# plot all together
plotvars
=
meta
.
loc
[
meta
[
Fields
.
PLOT
],
Fields
.
VARNAME
].
tolist
()
if
plotvars
:
plot
(
data
,
flags
,
True
,
plotvars
,
flagger
)
plotall_hook
(
data
,
flags
,
flagger
)
return
data
,
flags
This diff is collapsed.
Click to expand it.
saqc/lib/plotting.py
+
19
−
1
View file @
7a492375
...
...
@@ -3,8 +3,26 @@
from
warnings
import
warn
from
..core.config
import
Params
def
plot
(
data
,
flags
,
flagmask
,
varname
,
flagger
,
interactive_backend
=
True
,
title
=
"
Data Plot
"
,
show_nans
=
True
):
__plotvars
=
[]
def
plotall_hook
(
data
,
flags
,
flagger
):
if
len
(
__plotvars
)
>
1
:
_plot
(
data
,
flags
,
True
,
__plotvars
,
flagger
)
def
plot_hook
(
data
,
old
,
new
,
varname
,
do_plot
,
flag_test
,
flagger
):
if
do_plot
:
__plotvars
.
append
(
varname
)
# cannot use getFlags here, because if a flag was set (e.g. with force) the
# flag may be the same, but any additional row (e.g. comment-field) would differ
mask
=
(
old
[
varname
]
==
new
[
varname
]).
any
(
axis
=
1
)
_plot
(
data
,
new
,
mask
,
varname
,
flagger
,
title
=
flag_test
)
def
_plot
(
data
,
flags
,
flagmask
,
varname
,
flagger
,
interactive_backend
=
True
,
title
=
"
Data Plot
"
,
show_nans
=
True
):
# only import if plotting is requested by the user
import
matplotlib
as
mpl
...
...
This diff is collapsed.
Click to expand it.
test/core/test_core.py
+
2
−
2
View file @
7a492375
...
...
@@ -7,7 +7,7 @@ import pandas as pd
from
saqc.funcs
import
register
,
flagRange
from
saqc.core.core
import
runner
from
saqc.core.config
import
Fields
as
F
from
saqc.lib.plotting
import
plot
from
saqc.lib.plotting
import
_
plot
from
test.common
import
initData
,
initMetaDict
,
TESTFLAGGER
...
...
@@ -164,5 +164,5 @@ def test_plotting(data, flagger):
_
,
flagged
=
flagRange
(
data
,
flags
,
field
,
flagger
,
min
=
10
,
max
=
90
,
flag
=
flagger
.
BAD
)
_
,
flagged
=
flagRange
(
data
,
flagged
,
field
,
flagger
,
min
=
40
,
max
=
60
,
flag
=
flagger
.
GOOD
)
mask
=
flagger
.
getFlags
(
flags
,
field
)
!=
flagger
.
getFlags
(
flagged
,
field
)
plot
(
data
,
flagged
,
mask
,
field
,
flagger
,
interactive_backend
=
False
)
_
plot
(
data
,
flagged
,
mask
,
field
,
flagger
,
interactive_backend
=
False
)
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