Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
de935cf8
Commit
de935cf8
authored
2 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
further adjustments
parent
40ebb434
No related branches found
No related tags found
5 merge requests
!480
Merge multiple stats into crps working branch
,
!470
Develop
,
!467
Resolve "release v2.2.0"
,
!466
Draft: Resolve "Include CRPS analysis and other ens verif methods or plots"
,
!460
Resolve "TECH: reduce CI running time"
Pipeline
#108792
failed
2 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_run_modules/test_pre_processing.py
+13
-14
13 additions, 14 deletions
test/test_run_modules/test_pre_processing.py
with
13 additions
and
14 deletions
test/test_run_modules/test_pre_processing.py
+
13
−
14
View file @
de935cf8
...
...
@@ -28,17 +28,16 @@ class TestPreProcessing:
@pytest.fixture
def
obj_with_exp_setup
(
self
):
ExperimentSetup
(
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW087
'
,
'
DEBW99X
'
],
ExperimentSetup
(
stations
=
[
'
DEBW107
'
,
'
DEBW013
'
,
'
DEBW087
'
,
'
DEBW99X
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
station_type
=
"
background
"
,
data_origin
=
{
'
o3
'
:
'
UBA
'
,
'
temp
'
:
'
UBA
'
},
data_handler
=
DefaultDataHandler
)
data_origin
=
{
'
o3
'
:
'
UBA
'
,
'
temp
'
:
'
UBA
'
},
data_handler
=
DefaultDataHandler
)
pre
=
object
.
__new__
(
PreProcessing
)
super
(
PreProcessing
,
pre
).
__init__
()
yield
pre
RunEnvironment
().
__del__
()
def
test_init
(
self
,
caplog
):
ExperimentSetup
(
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW087
'
],
ExperimentSetup
(
stations
=
[
'
DEBW107
'
,
'
DEBW013
'
,
'
DEBW087
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
data_origin
=
{
'
o3
'
:
'
UBA
'
,
'
temp
'
:
'
UBA
'
})
caplog
.
clear
()
...
...
@@ -46,8 +45,8 @@ class TestPreProcessing:
with
PreProcessing
():
assert
caplog
.
record_tuples
[
0
]
==
(
'
root
'
,
20
,
'
PreProcessing started
'
)
assert
caplog
.
record_tuples
[
1
]
==
(
'
root
'
,
20
,
'
check valid stations started (preprocessing)
'
)
assert
caplog
.
record_tuples
[
-
6
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
'
run for \d+:\d+:\d+ \(hh:mm:ss\) to check
4
'
r
'
station\(s\). Found
4/4
valid stations.
'
))
assert
caplog
.
record_tuples
[
-
6
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
'
run for \d+:\d+:\d+ \(hh:mm:ss\) to check
3
'
r
'
station\(s\). Found
3/3
valid stations.
'
))
assert
caplog
.
record_tuples
[
-
5
]
==
(
'
root
'
,
20
,
"
use serial create_info_df (train)
"
)
assert
caplog
.
record_tuples
[
-
4
]
==
(
'
root
'
,
20
,
"
use serial create_info_df (val)
"
)
assert
caplog
.
record_tuples
[
-
3
]
==
(
'
root
'
,
20
,
"
use serial create_info_df (test)
"
)
...
...
@@ -77,23 +76,23 @@ class TestPreProcessing:
caplog
.
set_level
(
logging
.
DEBUG
)
obj_with_exp_setup
.
data_store
.
set
(
"
use_all_stations_on_all_data_sets
"
,
False
,
"
general
"
)
obj_with_exp_setup
.
create_set_split
(
slice
(
0
,
2
),
"
awesome
"
)
assert
(
'
root
'
,
10
,
"
Awesome stations (len=
2
): [
'
DEBW107
'
,
'
DEBY081
'
]
"
)
in
caplog
.
record_tuples
assert
(
'
root
'
,
10
,
"
Awesome stations (len=
1
): [
'
DEBW107
'
]
"
)
in
caplog
.
record_tuples
data_store
=
obj_with_exp_setup
.
data_store
assert
isinstance
(
data_store
.
get
(
"
data_collection
"
,
"
general.awesome
"
),
DataCollection
)
with
pytest
.
raises
(
NameNotFoundInScope
):
data_store
.
get
(
"
data_collection
"
,
"
general
"
)
assert
data_store
.
get
(
"
stations
"
,
"
general.awesome
"
)
==
[
"
DEBW107
"
,
"
DEBY081
"
]
assert
data_store
.
get
(
"
stations
"
,
"
general.awesome
"
)
==
[
"
DEBW107
"
]
def
test_create_set_split_all_stations
(
self
,
caplog
,
obj_with_exp_setup
):
caplog
.
set_level
(
logging
.
DEBUG
)
obj_with_exp_setup
.
create_set_split
(
slice
(
0
,
2
),
"
awesome
"
)
message
=
"
Awesome stations (len=5): [
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW087
'
,
'
DEBW99X
'
]
"
message
=
"
Awesome stations (len=5): [
'
DEBW107
'
,
'
DEBW013
'
,
'
DEBW087
'
,
'
DEBW99X
'
]
"
assert
(
'
root
'
,
10
,
message
)
in
caplog
.
record_tuples
data_store
=
obj_with_exp_setup
.
data_store
assert
isinstance
(
data_store
.
get
(
"
data_collection
"
,
"
general.awesome
"
),
DataCollection
)
with
pytest
.
raises
(
NameNotFoundInScope
):
data_store
.
get
(
"
data_collection
"
,
"
general
"
)
assert
data_store
.
get
(
"
stations
"
,
"
general.awesome
"
)
==
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW087
'
]
assert
data_store
.
get
(
"
stations
"
,
"
general.awesome
"
)
==
[
'
DEBW107
'
,
'
DEBW013
'
,
'
DEBW087
'
]
@pytest.mark.parametrize
(
"
name
"
,
(
None
,
"
tester
"
))
def
test_validate_station_serial
(
self
,
caplog
,
obj_with_exp_setup
,
name
):
...
...
@@ -108,8 +107,8 @@ class TestPreProcessing:
expected
=
"
check valid stations started
"
+
'
(%s)
'
%
(
name
if
name
else
'
all
'
)
assert
caplog
.
record_tuples
[
0
]
==
(
'
root
'
,
20
,
expected
)
assert
caplog
.
record_tuples
[
1
]
==
(
'
root
'
,
20
,
"
use serial validate station approach
"
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
'
run for \d+:\d+:\d+ \(hh:mm:ss\) to check
5
'
r
'
station\(s\). Found
4/5
valid stations.
'
))
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
'
run for \d+:\d+:\d+ \(hh:mm:ss\) to check
4
'
r
'
station\(s\). Found
3/4
valid stations.
'
))
@mock.patch
(
"
psutil.cpu_count
"
,
return_value
=
3
)
@mock.patch
(
"
multiprocessing.Pool
"
,
return_value
=
multiprocessing
.
Pool
(
3
))
...
...
@@ -126,8 +125,8 @@ class TestPreProcessing:
assert
caplog
.
record_tuples
[
0
]
==
(
'
root
'
,
20
,
"
check valid stations started (all)
"
)
assert
caplog
.
record_tuples
[
1
]
==
(
'
root
'
,
20
,
"
use parallel validate station approach
"
)
assert
caplog
.
record_tuples
[
2
]
==
(
'
root
'
,
20
,
"
running 3 processes in parallel
"
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
'
run for \d+:\d+:\d+ \(hh:mm:ss\) to check
5
'
r
'
station\(s\). Found
4/5
valid stations.
'
))
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
'
run for \d+:\d+:\d+ \(hh:mm:ss\) to check
4
'
r
'
station\(s\). Found
3/4
valid stations.
'
))
def
test_split_set_indices
(
self
,
obj_super_init
):
dummy_list
=
list
(
range
(
0
,
15
))
...
...
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