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
04ed44b0
Commit
04ed44b0
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
updated sampling statement in some tests
parent
a6d60a4c
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!37
include new development
,
!36
include using of hourly data
Pipeline
#29336
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_data_handling/test_data_generator.py
+7
-6
7 additions, 6 deletions
test/test_data_handling/test_data_generator.py
test/test_data_handling/test_data_preparation.py
+1
-0
1 addition, 0 deletions
test/test_data_handling/test_data_preparation.py
with
8 additions
and
6 deletions
test/test_data_handling/test_data_generator.py
+
7
−
6
View file @
04ed44b0
...
@@ -20,7 +20,7 @@ class TestDataGenerator:
...
@@ -20,7 +20,7 @@ class TestDataGenerator:
@pytest.fixture
@pytest.fixture
def
gen
(
self
):
def
gen
(
self
):
return
DataGenerator
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
data
'
),
'
AIRBASE
'
,
'
DEBW107
'
,
[
'
o3
'
,
'
temp
'
],
return
DataGenerator
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
data
'
),
'
AIRBASE
'
,
'
DEBW107
'
,
[
'
o3
'
,
'
temp
'
],
'
datetime
'
,
'
variables
'
,
'
o3
'
)
'
datetime
'
,
'
variables
'
,
'
o3
'
,
start
=
2010
,
end
=
2014
)
class
DummyDataPrep
:
class
DummyDataPrep
:
def
__init__
(
self
,
data
):
def
__init__
(
self
,
data
):
...
@@ -42,13 +42,14 @@ class TestDataGenerator:
...
@@ -42,13 +42,14 @@ class TestDataGenerator:
assert
gen
.
window_history_size
==
7
assert
gen
.
window_history_size
==
7
assert
gen
.
window_lead_time
==
4
assert
gen
.
window_lead_time
==
4
assert
gen
.
transform_method
==
"
standardise
"
assert
gen
.
transform_method
==
"
standardise
"
assert
gen
.
kwargs
==
{}
assert
gen
.
kwargs
==
{
"
start
"
:
2010
,
"
end
"
:
2014
}
def
test_repr
(
self
,
gen
):
def
test_repr
(
self
,
gen
):
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
data
'
)
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
data
'
)
assert
gen
.
__repr__
().
rstrip
()
==
f
"
DataGenerator(path=
'
{
path
}
'
, network=
'
AIRBASE
'
, stations=[
'
DEBW107
'
],
"
\
assert
gen
.
__repr__
().
rstrip
()
==
f
"
DataGenerator(path=
'
{
path
}
'
, network=
'
AIRBASE
'
, stations=[
'
DEBW107
'
],
"
\
f
"
variables=[
'
o3
'
,
'
temp
'
], station_type=None, interpolate_dim=
'
datetime
'
,
"
\
f
"
variables=[
'
o3
'
,
'
temp
'
], station_type=None, interpolate_dim=
'
datetime
'
,
"
\
f
"
target_dim=
'
variables
'
, target_var=
'
o3
'
, **{{}})
"
.
rstrip
()
f
"
target_dim=
'
variables
'
, target_var=
'
o3
'
, **{{
'
start
'
: 2010,
'
end
'
: 2014}})
"
\
.
rstrip
()
def
test_len
(
self
,
gen
):
def
test_len
(
self
,
gen
):
assert
len
(
gen
)
==
1
assert
len
(
gen
)
==
1
...
@@ -99,7 +100,7 @@ class TestDataGenerator:
...
@@ -99,7 +100,7 @@ class TestDataGenerator:
def
test_get_data_generator
(
self
,
gen
):
def
test_get_data_generator
(
self
,
gen
):
gen
.
kwargs
=
{
"
statistics_per_var
"
:
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
}}
gen
.
kwargs
=
{
"
statistics_per_var
"
:
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
}}
file
=
os
.
path
.
join
(
gen
.
data_path_tmp
,
f
"
DEBW107_
{
'
_
'
.
join
(
sorted
(
gen
.
variables
))
}
.pickle
"
)
file
=
os
.
path
.
join
(
gen
.
data_path_tmp
,
f
"
DEBW107_
{
'
_
'
.
join
(
sorted
(
gen
.
variables
))
}
_None_None_
.pickle
"
)
if
os
.
path
.
exists
(
file
):
if
os
.
path
.
exists
(
file
):
os
.
remove
(
file
)
os
.
remove
(
file
)
assert
not
os
.
path
.
exists
(
file
)
assert
not
os
.
path
.
exists
(
file
)
...
@@ -113,7 +114,7 @@ class TestDataGenerator:
...
@@ -113,7 +114,7 @@ class TestDataGenerator:
assert
os
.
stat
(
file
).
st_ctime
>
t
assert
os
.
stat
(
file
).
st_ctime
>
t
def
test_save_pickle_data
(
self
,
gen
):
def
test_save_pickle_data
(
self
,
gen
):
file
=
os
.
path
.
join
(
gen
.
data_path_tmp
,
f
"
DEBW107_
{
'
_
'
.
join
(
sorted
(
gen
.
variables
))
}
.pickle
"
)
file
=
os
.
path
.
join
(
gen
.
data_path_tmp
,
f
"
DEBW107_
{
'
_
'
.
join
(
sorted
(
gen
.
variables
))
}
_2010_2014_
.pickle
"
)
if
os
.
path
.
exists
(
file
):
if
os
.
path
.
exists
(
file
):
os
.
remove
(
file
)
os
.
remove
(
file
)
assert
not
os
.
path
.
exists
(
file
)
assert
not
os
.
path
.
exists
(
file
)
...
@@ -123,7 +124,7 @@ class TestDataGenerator:
...
@@ -123,7 +124,7 @@ class TestDataGenerator:
os
.
remove
(
file
)
os
.
remove
(
file
)
def
test_load_pickle_data
(
self
,
gen
):
def
test_load_pickle_data
(
self
,
gen
):
file
=
os
.
path
.
join
(
gen
.
data_path_tmp
,
f
"
DEBW107_
{
'
_
'
.
join
(
sorted
(
gen
.
variables
))
}
.pickle
"
)
file
=
os
.
path
.
join
(
gen
.
data_path_tmp
,
f
"
DEBW107_
{
'
_
'
.
join
(
sorted
(
gen
.
variables
))
}
_2010_2014_
.pickle
"
)
data
=
self
.
DummyDataPrep
(
np
.
ones
((
10
,
2
)))
data
=
self
.
DummyDataPrep
(
np
.
ones
((
10
,
2
)))
with
open
(
file
,
"
wb
"
)
as
f
:
with
open
(
file
,
"
wb
"
)
as
f
:
pickle
.
dump
(
data
,
f
)
pickle
.
dump
(
data
,
f
)
...
...
This diff is collapsed.
Click to expand it.
test/test_data_handling/test_data_preparation.py
+
1
−
0
View file @
04ed44b0
...
@@ -28,6 +28,7 @@ class TestDataPrep:
...
@@ -28,6 +28,7 @@ class TestDataPrep:
d
.
station
=
[
'
DEBW107
'
]
d
.
station
=
[
'
DEBW107
'
]
d
.
variables
=
[
'
o3
'
,
'
temp
'
]
d
.
variables
=
[
'
o3
'
,
'
temp
'
]
d
.
station_type
=
"
background
"
d
.
station_type
=
"
background
"
d
.
sampling
=
"
daily
"
d
.
kwargs
=
None
d
.
kwargs
=
None
return
d
return
d
...
...
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