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
58b9e904
Commit
58b9e904
authored
4 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
added var based masking to modelling_mask
parent
21add277
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
,
!85
Seasonal and custom data masking
Pipeline
#6623
failed with stage
in 5 minutes and 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/data_modelling.py
+12
-12
12 additions, 12 deletions
saqc/funcs/data_modelling.py
with
12 additions
and
12 deletions
saqc/funcs/data_modelling.py
+
12
−
12
View file @
58b9e904
...
...
@@ -250,7 +250,7 @@ def modelling_rollingMean(data, field, flagger, winsz, eval_flags=True, min_peri
return
data
,
flagger
def
modelling_mask
(
data
,
field
,
flagger
,
mode
,
loc
_var
=
None
,
season_start
=
None
,
season_end
=
None
):
def
modelling_mask
(
data
,
field
,
flagger
,
mode
,
mask
_var
=
None
,
season_start
=
None
,
season_end
=
None
):
data
=
data
.
copy
()
datcol
=
data
[
field
]
mask
=
pd
.
Series
(
False
,
index
=
datcol
.
index
)
...
...
@@ -268,12 +268,8 @@ def modelling_mask(data, field, flagger, mode, loc_var=None, season_start=None,
if
len
(
stamp
)
==
14
:
return
'
{}-
'
.
format
(
index
.
year
[
0
])
+
stamp
if
pd
.
Timestamp
(
_composeStamp
(
datcol
.
index
,
season_start
))
<=
pd
.
Timestamp
(
_composeStamp
(
datcol
.
index
,
season_end
)):
overlap
=
False
else
:
overlap
=
True
if
not
overlap
:
if
pd
.
Timestamp
(
_composeStamp
(
datcol
.
index
,
season_start
))
<=
pd
.
Timestamp
(
_composeStamp
(
datcol
.
index
,
season_end
)):
def
_selector
(
x
,
start
=
season_start
,
end
=
season_end
):
x
[
_composeStamp
(
x
.
index
,
start
):
_composeStamp
(
x
.
index
,
end
)]
=
True
return
x
...
...
@@ -282,11 +278,15 @@ def modelling_mask(data, field, flagger, mode, loc_var=None, season_start=None,
x
[:
_composeStamp
(
x
.
index
,
start
)]
=
True
x
[
_composeStamp
(
x
.
index
,
end
):]
=
True
return
x
freq
=
'
1
'
+
'
mmmhhhdddMMMYYY
'
[
len
(
season_start
)]
seasonal_mask
=
mask
.
groupby
(
pd
.
Grouper
(
freq
=
freq
)).
transform
(
_selector
)
datcol
[
~
seasonal_mask
]
=
np
.
nan
flags_to_block
=
pd
.
Series
(
np
.
nan
,
index
=
datcol
.
index
[
~
seasonal_mask
]).
astype
(
flagger
.
dtype
)
flagger
=
flagger
.
setFlags
(
field
,
loc
=
datcol
.
index
[
~
seasonal_mask
],
flag
=
flags_to_block
,
force
=
True
)
freq
=
'
1
'
+
'
mmmhhhdddMMMYYY
'
[
len
(
season_start
)]
to_mask
=
mask
.
groupby
(
pd
.
Grouper
(
freq
=
freq
)).
transform
(
_selector
)
elif
mode
==
'
mask_var
'
:
to_mask
=
data
[
mask_var
]
to_mask
=
to_mask
.
index
.
join
(
datcol
.
index
,
how
=
'
inner
'
)
datcol
[
~
to_mask
]
=
np
.
nan
flags_to_block
=
pd
.
Series
(
np
.
nan
,
index
=
datcol
.
index
[
~
to_mask
]).
astype
(
flagger
.
dtype
)
flagger
=
flagger
.
setFlags
(
field
,
loc
=
datcol
.
index
[
~
to_mask
],
flag
=
flags_to_block
,
force
=
True
)
return
data
,
flagger
\ 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