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
3df1c16f
Commit
3df1c16f
authored
5 years ago
by
David Schäfer
Browse files
Options
Downloads
Patches
Plain Diff
a small cleanup
parent
401c7e04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/functions.py
+8
-8
8 additions, 8 deletions
saqc/funcs/functions.py
with
8 additions
and
8 deletions
saqc/funcs/functions.py
+
8
−
8
View file @
3df1c16f
...
...
@@ -137,22 +137,20 @@ def flagIsolated(
dat_col
=
data
[
field
][
~
drop_mask
]
dat_col
.
dropna
(
inplace
=
True
)
gap_check
=
dat_col
.
rolling
(
isolation_range
).
count
()
gap_check
=
gap_check
[(
gap_check
.
index
[
0
]
+
pd
.
Timedelta
(
isolation_range
)):]
if
max_isolated_group_size
==
1
:
# isolated single values are much easier to identify:
gap_check
=
dat_col
.
rolling
(
isolation_range
).
count
()
# exclude series initials:
gap_check
=
gap_check
[(
gap_check
.
index
[
0
]
+
pd
.
Timedelta
(
isolation_range
))
:]
# reverse rolling trick:
isolated_indices
=
gap_check
[
(
gap_check
[::
-
1
].
rolling
(
2
).
sum
()
==
2
)[::
-
1
].
values
].
index
else
:
gap_check
=
dat_col
.
rolling
(
isolation_range
).
count
()
# check, which groups are centered enough for being isolated
continuation_check
=
gap_check
.
rolling
(
continuation_range
).
count
()
# exclude series initials:
gap_check
=
gap_check
[(
gap_check
.
index
[
0
]
+
pd
.
Timedelta
(
isolation_range
))
:]
# check which values are sparsely enough surrounded
gap_check
=
(
gap_check
[::
-
1
]
...
...
@@ -168,9 +166,11 @@ def flagIsolated(
isolated_indices
=
isolated_indices
[
continuation_check
[
isolated_indices
]
<=
max_isolated_group_size
]
# propagate True value onto entire isolated group (will not work with bfill method, because its not sure the
# frequencie grid is actually equidistant - so here comes rolling reverse trick for offset defined windows
# again):
# propagate True value onto entire isolated group
# NOTE:
# will not work with bfill method, because its not sure the frequency
# grid is actually equidistant - so here comes the rolling reverse
# trick for offset defined windows again
gap_check
[:]
=
np
.
nan
gap_check
.
loc
[
isolated_indices
]
=
True
original_index
=
gap_check
.
index
...
...
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