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
f4e6a50a
Commit
f4e6a50a
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
added small check for var and stat
parent
36496b84
No related branches found
No related tags found
2 merge requests
!37
include new development
,
!32
added small check for var and stat
Pipeline
#29045
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/run_modules/experiment_setup.py
+12
-0
12 additions, 0 deletions
src/run_modules/experiment_setup.py
test/test_modules/test_experiment_setup.py
+11
-0
11 additions, 0 deletions
test/test_modules/test_experiment_setup.py
with
23 additions
and
0 deletions
src/run_modules/experiment_setup.py
+
12
−
0
View file @
f4e6a50a
...
...
@@ -67,6 +67,7 @@ class ExperimentSetup(RunEnvironment):
self
.
_set_param
(
"
station_type
"
,
station_type
,
default
=
None
)
self
.
_set_param
(
"
variables
"
,
variables
,
default
=
list
(
self
.
data_store
.
get
(
"
var_all_dict
"
,
"
general
"
).
keys
()))
self
.
_set_param
(
"
statistics_per_var
"
,
statistics_per_var
,
default
=
self
.
data_store
.
get
(
"
var_all_dict
"
,
"
general
"
))
self
.
_compare_variables_and_statistics
()
self
.
_set_param
(
"
start
"
,
start
,
default
=
"
1997-01-01
"
,
scope
=
"
general
"
)
self
.
_set_param
(
"
end
"
,
end
,
default
=
"
2017-12-31
"
,
scope
=
"
general
"
)
self
.
_set_param
(
"
window_history_size
"
,
window_history_size
,
default
=
13
)
...
...
@@ -122,6 +123,17 @@ class ExperimentSetup(RunEnvironment):
else
:
return
{}
def
_compare_variables_and_statistics
(
self
):
logging
.
debug
(
"
check if all variables are included in statistics_per_var
"
)
var
=
self
.
data_store
.
get
(
"
variables
"
,
"
general
"
)
stat
=
self
.
data_store
.
get
(
"
statistics_per_var
"
,
"
general
"
)
if
not
set
(
var
).
issubset
(
stat
.
keys
()):
missing
=
set
(
var
).
difference
(
stat
.
keys
())
raise
ValueError
(
f
"
Comparison of given variables and statistics_per_var show that not all requested
"
f
"
variables are part of statistics_per_var. Please add also information on the missing
"
f
"
statistics for the variables:
{
missing
}
"
)
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
test/test_modules/test_experiment_setup.py
+
11
−
0
View file @
f4e6a50a
...
...
@@ -149,3 +149,14 @@ class TestExperimentSetup:
assert
data_store
.
get
(
"
end
"
,
"
general.test
"
)
==
"
2000-01-06
"
# use all stations on all data sets (train, val, test)
assert
data_store
.
get
(
"
use_all_stations_on_all_data_sets
"
,
"
general.test
"
)
is
False
def
test_compare_variables_and_statistics
(
self
):
kwargs
=
dict
(
parser_args
=
{
"
experiment_date
"
:
"
TODAY
"
},
var_all_dict
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
stations
=
[
'
DEBY053
'
,
'
DEBW059
'
,
'
DEBW027
'
],
variables
=
[
"
o3
"
,
"
relhum
"
],
statistics_per_var
=
None
)
with
pytest
.
raises
(
ValueError
)
as
e
:
ExperimentSetup
(
**
kwargs
)
assert
"
for the variables: {
'
relhum
'
}
"
in
e
.
value
.
args
[
0
]
kwargs
[
"
variables
"
]
=
[
"
o3
"
,
"
temp
"
]
assert
ExperimentSetup
(
**
kwargs
)
is
not
None
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