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
bdd0470b
Commit
bdd0470b
authored
5 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
cleanups
parent
4d30fa08
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/core/core.py
+22
-14
22 additions, 14 deletions
saqc/core/core.py
with
22 additions
and
14 deletions
saqc/core/core.py
+
22
−
14
View file @
bdd0470b
...
...
@@ -60,12 +60,32 @@ def _checkInput(data, flags, flagger):
# NOTE: do not test columns as they not necessarily must be the same
def
_handleErrors
(
err
,
configrow
,
test
,
policy
):
line
=
configrow
[
Fields
.
LINENUMBER
]
msg
=
f
"
config, line
{
line
}
, test: `
{
test
}
` failed with `
{
type
(
err
).
__name__
}
:
{
err
}
`
"
if
policy
==
"
ignore
"
:
logging
.
debug
(
msg
)
return
False
elif
policy
==
"
warn
"
:
logging
.
warning
(
msg
)
return
False
return
True
def
_setup
():
pd
.
set_option
(
"
mode.chained_assignment
"
,
"
warn
"
)
np
.
seterr
(
invalid
=
"
ignore
"
)
def
runner
(
config_file
,
flagger
,
data
,
flags
=
None
,
nodata
=
np
.
nan
,
error_policy
=
"
raise
"
):
def
runner
(
config_file
:
str
,
flagger
:
BaseFlagger
,
data
:
pd
.
DataFrame
,
flags
:
pd
.
DataFrame
=
None
,
nodata
:
float
=
np
.
nan
,
error_policy
:
str
=
"
raise
"
,
)
->
(
pd
.
DataFrame
,
BaseFlagger
):
_setup
()
_checkInput
(
data
,
flags
,
flagger
)
config
=
prepareConfig
(
readConfig
(
config_file
),
data
)
...
...
@@ -85,7 +105,6 @@ def runner(config_file, flagger, data, flags=None, nodata=np.nan, error_policy="
# user-test needs fully prepared flags
checkConfig
(
config
,
data
,
flagger
,
nodata
)
# NOTE:
# the outer loop runs over the flag tests, the inner one over the
# variables. Switching the loop order would complicate the
...
...
@@ -132,6 +151,7 @@ def runner(config_file, flagger, data, flags=None, nodata=np.nan, error_policy="
if
_handleErrors
(
e
,
configrow
,
func
,
error_policy
):
raise
e
continue
# import ipdb; ipdb.set_trace()
if
configrow
[
Fields
.
PLOT
]:
plotHook
(
...
...
@@ -149,19 +169,7 @@ def runner(config_file, flagger, data, flags=None, nodata=np.nan, error_policy="
flagger
=
flagger_chunk_result
data
=
data_chunk_result
plotAllHook
(
data
,
flagger
)
return
data
,
flagger
def
_handleErrors
(
err
,
configrow
,
test
,
policy
):
line
=
configrow
[
Fields
.
LINENUMBER
]
msg
=
f
"
config, line
{
line
}
, test: `
{
test
}
` failed with `
{
type
(
err
).
__name__
}
:
{
err
}
`
"
if
policy
==
"
ignore
"
:
logging
.
debug
(
msg
)
return
False
elif
policy
==
"
warn
"
:
logging
.
warning
(
msg
)
return
False
return
True
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