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
42b49aa8
Commit
42b49aa8
authored
4 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
replace IF-construction in seasonalMask with uniform function definition
parent
fab6e253
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
#6751
failed with stage
Stage: test
in 6 minutes and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/lib/tools.py
+12
-23
12 additions, 23 deletions
saqc/lib/tools.py
with
12 additions
and
23 deletions
saqc/lib/tools.py
+
12
−
23
View file @
42b49aa8
...
@@ -278,29 +278,18 @@ def seasonalMask(dtindex, season_start, season_end, inclusive_selection):
...
@@ -278,29 +278,18 @@ def seasonalMask(dtindex, season_start, season_end, inclusive_selection):
"
. Please select from
'
mask
'
and
'
season
'
.
"
"
. Please select from
'
mask
'
and
'
season
'
.
"
.
format
(
inclusive_selection
))
.
format
(
inclusive_selection
))
mask
=
pd
.
Series
(
base_bool
,
index
=
dtindex
)
mask
=
pd
.
Series
(
base_bool
,
index
=
dtindex
)
if
len
(
season_start
)
==
2
:
def
_composeStamp
(
index
,
stamp
):
def
_composeStamp
(
index
,
stamp
):
return
'
{}-{}-{} {}:{}:
'
.
format
(
index
.
year
[
0
],
index
.
month
[
0
],
index
.
day
[
0
],
index
.
hour
[
0
],
stamp_list
=
[
stamp
[
i
:
i
+
2
]
for
i
in
range
(
len
(
stamp
))][::
3
]
index
.
minute
[
0
])
+
stamp
index_list
=
[
f
"
{
index
.
year
[
0
]
}
"
,
f
"
{
index
.
month
[
0
]
:
02
}
"
,
f
"
{
index
.
day
[
0
]
:
02
}
"
,
f
"
{
index
.
hour
[
0
]
:
02
}
"
,
elif
len
(
season_start
)
==
5
:
f
"
{
index
.
minute
[
0
]
:
02
}
"
,
def
_composeStamp
(
index
,
stamp
):
f
"
{
index
.
second
[
0
]
:
02
}
"
][:
-
len
(
stamp_list
)]
return
'
{}-{}-{} {}:
'
.
format
(
index
.
year
[
0
],
index
.
month
[
0
],
index
.
day
[
0
],
index
.
hour
[
0
])
+
stamp
final
=
index_list
+
stamp_list
elif
len
(
season_start
)
==
8
:
# some hick-hack ahead, to account for the strange fact that not all the month are of same length in
def
_composeStamp
(
index
,
stamp
):
# this world.
return
'
{}-{}-{}
'
.
format
(
index
.
year
[
0
],
index
.
month
[
0
],
index
.
day
[
0
])
+
stamp
max_days
=
(
31
,
29
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
)
elif
len
(
season_start
)
==
11
:
month_day
=
min
(
int
(
final
[
2
]),
max_days
[
int
(
index
.
month
[
0
]
-
1
)])
def
_composeStamp
(
index
,
stamp
):
return
f
"
{
final
[
0
]
}
-
{
final
[
1
]
}
-
{
month_day
:
02
}
T
{
final
[
3
]
}
:
{
final
[
4
]
}
:
{
final
[
5
]
}
"
# some hick-hack ahead, to account for the strange fact that not all the month are of same length in
# this world.
max_days
=
[
31
,
29
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
]
max_day_count
=
min
(
int
(
stamp
[:
2
]),
max_days
[
int
(
index
.
month
[
0
]
-
1
)])
stamp
=
str
(
max_day_count
)
+
stamp
[
2
:]
return
'
{}-{}-
'
.
format
(
index
.
year
[
0
],
index
.
month
[
0
])
+
stamp
elif
len
(
season_start
)
==
14
:
def
_composeStamp
(
index
,
stamp
):
return
'
{}-
'
.
format
(
index
.
year
[
0
])
+
stamp
else
:
raise
ValueError
(
"
What´s this?: {}
"
.
format
(
season_start
))
if
pd
.
Timestamp
(
_composeStamp
(
dtindex
,
season_start
))
<=
pd
.
Timestamp
(
_composeStamp
(
dtindex
,
if
pd
.
Timestamp
(
_composeStamp
(
dtindex
,
season_start
))
<=
pd
.
Timestamp
(
_composeStamp
(
dtindex
,
season_end
)):
season_end
)):
...
...
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