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
88fa6188
Commit
88fa6188
authored
6 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
unified signatures of flagGeneric and the implemented test, moved the latter to funcs
parent
2619e769
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
config.py
+11
-11
11 additions, 11 deletions
config.py
core.py
+3
-13
3 additions, 13 deletions
core.py
funcs/__init__.py
+11
-0
11 additions, 0 deletions
funcs/__init__.py
funcs/functions.py
+14
-1
14 additions, 1 deletion
funcs/functions.py
with
39 additions
and
25 deletions
config.py
+
11
−
11
View file @
88fa6188
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from
funcs
import
funcs
import
funcs
import
numpy
as
np
...
...
@@ -12,19 +12,19 @@ class Fields:
FLAGS
=
"
Flag*
"
class
Params
:
NAME
=
"
name
"
FUNC
=
"
func
"
FLAGPERIOD
=
"
flag_period
"
FLAGVALUES
=
"
flag_values
"
FLAG
=
"
flag
"
#
class Params:
#
NAME = "name"
#
FUNC = "func"
#
FLAGPERIOD = "flag_period"
#
FLAGVALUES = "flag_values"
#
FLAG = "flag"
FUNCMAP
=
{
"
ma
intenance
"
:
funcs
.
flagMa
intenance
,
"
ma
n_flag
"
:
funcs
.
flagMa
nual
,
"
MAD
"
:
funcs
.
flag
Mad
,
"
constant
"
:
funcs
.
flag
Constant
"
ma
nflag
"
:
funcs
.
flagMa
nual
,
"
ma
d
"
:
funcs
.
flagMa
d
,
"
constant
"
:
funcs
.
flag
Constant
,
"
generic
"
:
funcs
.
flag
Generic
}
NODATA
=
np
.
nan
This diff is collapsed.
Click to expand it.
core.py
+
3
−
13
View file @
88fa6188
...
...
@@ -6,7 +6,8 @@ from math import ceil
import
numpy
as
np
import
pandas
as
pd
from
config
import
Fields
,
FUNCMAP
,
Params
,
NODATA
from
config
import
Fields
,
FUNCMAP
,
NODATA
from
funcs
import
Params
from
dsl
import
evalCondition
,
parseFlag
from
flagger
import
PositionalFlagger
,
BaseFlagger
from
lib.types
import
ArrayLike
...
...
@@ -34,14 +35,6 @@ def flagNext(flagger: BaseFlagger, flags: ArrayLike, n: int) -> ArrayLike:
return
flags
def
flagGeneric
(
data
,
flags
,
field
,
flagger
,
**
flag_params
):
to_flag
=
evalCondition
(
flag_params
[
Params
.
FUNC
],
flagger
,
data
,
flags
,
field
,
nodata
=
NODATA
)
fchunk
=
flagger
.
setFlag
(
flags
=
flags
.
loc
[
to_flag
,
field
],
**
flag_params
)
flags
.
loc
[
to_flag
,
field
]
=
fchunk
return
flags
...
...
@@ -103,10 +96,7 @@ def flaggingRunner(meta, flagger, data, flags=None):
func
=
FUNCMAP
.
get
(
flag_name
,
None
)
if
func
:
dchunk
,
fchunk
=
func
(
dchunk
,
fchunk
,
varname
,
flagger
,
**
flag_params
)
elif
flag_name
==
"
generic
"
:
fchunk
=
flagGeneric
(
dchunk
,
fchunk
,
varname
,
flagger
,
**
flag_params
)
flagger
,
nodata
=
NODATA
,
**
flag_params
)
else
:
raise
RuntimeError
(
"
malformed flag field (
'
{:}
'
) for variable: {:}
"
...
...
This diff is collapsed.
Click to expand it.
funcs/__init__.py
+
11
−
0
View file @
88fa6188
#! /usr/bin/env python
# -*- coding: utf-8 -*-
class
Params
:
NAME
=
"
name
"
FUNC
=
"
func
"
FLAGPERIOD
=
"
flag_period
"
FLAGVALUES
=
"
flag_values
"
FLAG
=
"
flag
"
from
.functions
import
*
This diff is collapsed.
Click to expand it.
funcs/funcs.py
→
funcs/func
tion
s.py
+
14
−
1
View file @
88fa6188
...
...
@@ -4,9 +4,22 @@
import
numpy
as
np
import
pandas
as
pd
from
lib.tools
import
valueRange
,
slidingWindowIndices
from
dsl
import
evalCondition
from
.
import
Params
def
flagMaintenance
(
data
,
flags
,
field
,
flagger
,
**
kwargs
):
def
flagGeneric
(
data
,
flags
,
field
,
flagger
,
nodata
=
np
.
nan
,
**
flag_params
):
to_flag
=
evalCondition
(
flag_params
[
Params
.
FUNC
],
flagger
,
data
,
flags
,
field
,
nodata
=
nodata
)
try
:
fchunk
=
flagger
.
setFlag
(
flags
=
flags
.
loc
[
to_flag
,
field
],
**
flag_params
)
except
:
import
ipdb
;
ipdb
.
set_trace
()
flags
.
loc
[
to_flag
,
field
]
=
fchunk
return
data
,
flags
...
...
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