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
d4abd2ac
Commit
d4abd2ac
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
add station_type check for local stored data
parent
5a7ec78a
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!17
update to v0.4.0
,
!16
handle station type
Pipeline
#26578
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/data_preparation.py
+9
-1
9 additions, 1 deletion
src/data_preparation.py
with
9 additions
and
1 deletion
src/data_preparation.py
+
9
−
1
View file @
d4abd2ac
...
@@ -80,12 +80,20 @@ class DataPrep(object):
...
@@ -80,12 +80,20 @@ class DataPrep(object):
data
=
self
.
_slice_prep
(
xr
.
open_dataarray
(
file_name
))
data
=
self
.
_slice_prep
(
xr
.
open_dataarray
(
file_name
))
self
.
data
=
self
.
check_for_negative_concentrations
(
data
)
self
.
data
=
self
.
check_for_negative_concentrations
(
data
)
self
.
meta
=
pd
.
read_csv
(
meta_file
,
index_col
=
0
)
self
.
meta
=
pd
.
read_csv
(
meta_file
,
index_col
=
0
)
if
self
.
station_type
is
not
None
:
self
.
check_station_type
()
except
FileNotFoundError
as
e
:
except
FileNotFoundError
as
e
:
logging
.
warning
(
e
)
logging
.
warning
(
e
)
data
,
self
.
meta
=
self
.
download_data_from_join
(
file_name
,
meta_file
)
data
,
self
.
meta
=
self
.
download_data_from_join
(
file_name
,
meta_file
)
data
=
self
.
_slice_prep
(
data
)
data
=
self
.
_slice_prep
(
data
)
self
.
data
=
self
.
check_for_negative_concentrations
(
data
)
self
.
data
=
self
.
check_for_negative_concentrations
(
data
)
def
check_station_type
(
self
):
if
self
.
meta
.
at
[
"
station_type
"
,
self
.
station
[
0
]]
!=
self
.
station_type
:
self
.
data
=
None
self
.
meta
=
None
raise
join
.
EmptyQueryResult
def
download_data_from_join
(
self
,
file_name
:
str
,
meta_file
:
str
)
->
[
xr
.
DataArray
,
pd
.
DataFrame
]:
def
download_data_from_join
(
self
,
file_name
:
str
,
meta_file
:
str
)
->
[
xr
.
DataArray
,
pd
.
DataFrame
]:
"""
"""
Download data from TOAR database using the JOIN interface.
Download data from TOAR database using the JOIN interface.
...
@@ -114,7 +122,7 @@ class DataPrep(object):
...
@@ -114,7 +122,7 @@ class DataPrep(object):
def
__repr__
(
self
):
def
__repr__
(
self
):
return
f
"
Dataprep(path=
'
{
self
.
path
}
'
, network=
'
{
self
.
network
}
'
, station=
{
self
.
station
}
,
"
\
return
f
"
Dataprep(path=
'
{
self
.
path
}
'
, network=
'
{
self
.
network
}
'
, station=
{
self
.
station
}
,
"
\
f
"
variables=
{
self
.
variables
}
, **
{
self
.
kwargs
}
)
"
f
"
variables=
{
self
.
variables
}
,
station_type=
'
{
self
.
station_type
}
'
,
**
{
self
.
kwargs
}
)
"
def
interpolate
(
self
,
dim
:
str
,
method
:
str
=
'
linear
'
,
limit
:
int
=
None
,
def
interpolate
(
self
,
dim
:
str
,
method
:
str
=
'
linear
'
,
limit
:
int
=
None
,
use_coordinate
:
Union
[
bool
,
str
]
=
True
,
**
kwargs
):
use_coordinate
:
Union
[
bool
,
str
]
=
True
,
**
kwargs
):
...
...
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