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
3e092797
Commit
3e092797
authored
4 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
added empty intervals flag keyword to proc_resample
parent
c43517a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!193
Release 1.4
,
!188
Release 1.4
,
!49
Dataprocessing features
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/proc_functions.py
+12
-6
12 additions, 6 deletions
saqc/funcs/proc_functions.py
with
12 additions
and
6 deletions
saqc/funcs/proc_functions.py
+
12
−
6
View file @
3e092797
...
@@ -104,7 +104,8 @@ def proc_interpolateGrid(data, field, flagger, freq, method, inter_order=2, drop
...
@@ -104,7 +104,8 @@ def proc_interpolateGrid(data, field, flagger, freq, method, inter_order=2, drop
flagscol
[
flagscol
.
isna
()]
=
empty_intervals_flag
flagscol
[
flagscol
.
isna
()]
=
empty_intervals_flag
# ...hack done
# ...hack done
# we might miss the flag for interpolated data grids last entry (its always nan - just settling a convention here):
# we might miss the flag for interpolated data grids last entry (if we miss it - the datapoint is always nan
# - just settling a convention here):
if
inter_data
.
shape
[
0
]
>
flagscol
.
shape
[
0
]:
if
inter_data
.
shape
[
0
]
>
flagscol
.
shape
[
0
]:
flagscol
=
flagscol
.
append
(
pd
.
Series
(
empty_intervals_flag
,
index
=
[
datcol
.
index
[
-
1
]]))
flagscol
=
flagscol
.
append
(
pd
.
Series
(
empty_intervals_flag
,
index
=
[
datcol
.
index
[
-
1
]]))
...
@@ -120,21 +121,23 @@ def proc_interpolateGrid(data, field, flagger, freq, method, inter_order=2, drop
...
@@ -120,21 +121,23 @@ def proc_interpolateGrid(data, field, flagger, freq, method, inter_order=2, drop
@register
@register
def
proc_resample
(
data
,
field
,
flagger
,
freq
,
func
=
np
.
mean
,
max_invalid_total_d
=
np
.
inf
,
max_invalid_consec_d
=
np
.
inf
,
def
proc_resample
(
data
,
field
,
flagger
,
freq
,
func
=
np
.
mean
,
max_invalid_total_d
=
np
.
inf
,
max_invalid_consec_d
=
np
.
inf
,
max_invalid_consec_f
=
np
.
inf
,
max_invalid_total_f
=
np
.
inf
,
flag_agg_func
=
max
,
method
=
'
bagg
'
,
**
kwargs
):
max_invalid_consec_f
=
np
.
inf
,
max_invalid_total_f
=
np
.
inf
,
flag_agg_func
=
max
,
method
=
'
bagg
'
,
empty_intervals_flag
=
None
,
**
kwargs
):
data
=
data
.
copy
()
data
=
data
.
copy
()
datcol
=
data
[
field
]
datcol
=
data
[
field
]
flagscol
=
flagger
.
getFlags
(
field
)
flagscol
=
flagger
.
getFlags
(
field
)
if
empty_intervals_flag
is
None
:
empty_intervals_flag
=
flagger
.
BAD
if
func
==
"
shift
"
:
if
func
==
"
shift
"
:
datcol
=
shift2Freq
(
datcol
,
method
,
freq
,
fill_value
=
np
.
nan
)
datcol
=
shift2Freq
(
datcol
,
method
,
freq
,
fill_value
=
np
.
nan
)
flagscol
=
shift2Freq
(
flagscol
,
method
,
freq
,
fill_value
=
flagger
.
BAD
)
flagscol
=
shift2Freq
(
flagscol
,
method
,
freq
,
fill_value
=
empty_intervals_flag
)
else
:
else
:
datcol
=
aggregate2Freq
(
datcol
,
method
,
freq
,
func
,
fill_value
=
np
.
nan
,
datcol
=
aggregate2Freq
(
datcol
,
method
,
freq
,
func
,
fill_value
=
np
.
nan
,
max_invalid_total
=
max_invalid_total_d
,
max_invalid_consec
=
max_invalid_consec_d
)
max_invalid_total
=
max_invalid_total_d
,
max_invalid_consec
=
max_invalid_consec_d
)
flagscol
=
aggregate2Freq
(
flagscol
,
method
,
freq
,
flag_agg_func
,
fill_value
=
flagger
.
BAD
,
flagscol
=
aggregate2Freq
(
flagscol
,
method
,
freq
,
flag_agg_func
,
fill_value
=
empty_intervals_flag
,
max_invalid_total
=
max_invalid_total_f
,
max_invalid_consec
=
max_invalid_consec_f
)
max_invalid_total
=
max_invalid_total_f
,
max_invalid_consec
=
max_invalid_consec_f
)
# data/flags reshaping:
# data/flags reshaping:
...
@@ -151,4 +154,7 @@ def proc_transform(data, field, flagger, func, **kwargs):
...
@@ -151,4 +154,7 @@ def proc_transform(data, field, flagger, func, **kwargs):
# (so interpolations wouldn't work)
# (so interpolations wouldn't work)
new_col
=
pd
.
Series
(
func
(
data
[
field
]),
index
=
data
[
field
].
index
)
new_col
=
pd
.
Series
(
func
(
data
[
field
]),
index
=
data
[
field
].
index
)
data
[
field
]
=
new_col
data
[
field
]
=
new_col
return
data
,
flagger
return
data
,
flagger
\ No newline at end of file
#@register
#def proc_projectFlags(data, field, flagger, target_field, **kwargs):
\ No newline at end of file
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