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
0e7540cd
Commit
0e7540cd
authored
3 years ago
by
Felix Kleinert
Browse files
Options
Downloads
Patches
Plain Diff
reset decode_cf to open_mfdataset method
parent
36ab4c0f
No related branches found
No related tags found
2 merge requests
!321
Resolve "Apply TOAR Statistics on WRF-data handler"
,
!259
Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline
#76525
failed
3 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
mlair/data_handler/data_handler_wrf_chem.py
+10
-4
10 additions, 4 deletions
mlair/data_handler/data_handler_wrf_chem.py
with
10 additions
and
4 deletions
mlair/data_handler/data_handler_wrf_chem.py
+
10
−
4
View file @
0e7540cd
...
@@ -174,7 +174,7 @@ class BaseWrfChemDataLoader:
...
@@ -174,7 +174,7 @@ class BaseWrfChemDataLoader:
"""
"""
if
(
self
.
start_time
is
None
)
and
(
self
.
end_time
is
None
):
if
(
self
.
start_time
is
None
)
and
(
self
.
end_time
is
None
):
path_list
=
os
.
path
.
join
(
self
.
data_path
,
self
.
common_file_starter
+
'
*
'
)
path_list
=
os
.
path
.
join
(
self
.
data_path
,
self
.
common_file_starter
+
'
*
'
)
logging
.
info
(
f
"
Reading file(s):
{
path_list
}
"
)
#
logging.info(f"Reading file(s): {path_list}")
return
path_list
return
path_list
elif
(
self
.
start_time
is
not
None
)
and
(
self
.
end_time
is
not
None
):
elif
(
self
.
start_time
is
not
None
)
and
(
self
.
end_time
is
not
None
):
path_list
=
set
()
path_list
=
set
()
...
@@ -184,7 +184,7 @@ class BaseWrfChemDataLoader:
...
@@ -184,7 +184,7 @@ class BaseWrfChemDataLoader:
self
.
date_format_of_nc_file
)
+
'
*
'
self
.
date_format_of_nc_file
)
+
'
*
'
))[
0
])
))[
0
])
path_list
=
sorted
(
list
(
path_list
))
path_list
=
sorted
(
list
(
path_list
))
logging
.
info
(
f
"
Reading file(s):
{
path_list
}
"
)
#
logging.info(f"Reading file(s): {path_list}")
return
path_list
return
path_list
else
:
else
:
raise
ValueError
(
f
"
`start_time
'
and `end_time
'
must both be given or None.
"
)
raise
ValueError
(
f
"
`start_time
'
and `end_time
'
must both be given or None.
"
)
...
@@ -200,10 +200,16 @@ class BaseWrfChemDataLoader:
...
@@ -200,10 +200,16 @@ class BaseWrfChemDataLoader:
# see also https://github.com/pydata/xarray/issues/1385#issuecomment-438870575
# see also https://github.com/pydata/xarray/issues/1385#issuecomment-438870575
data
=
xr
.
open_mfdataset
(
paths
=
self
.
dataset_search_str
,
combine
=
'
nested
'
,
concat_dim
=
self
.
time_dim_name
,
data
=
xr
.
open_mfdataset
(
paths
=
self
.
dataset_search_str
,
combine
=
'
nested
'
,
concat_dim
=
self
.
time_dim_name
,
parallel
=
True
,
decode_cf
=
False
)
parallel
=
True
,
decode_cf
=
False
)
data
=
xr
.
decode_cf
(
data
)
logging
.
info
(
f
"
Reading file(s):
{
self
.
dataset_search_str
}
"
)
else
:
else
:
data
=
xr
.
open_mfdataset
(
paths
=
self
.
dataset_search_str
,
combine
=
'
nested
'
,
concat_dim
=
self
.
time_dim_name
,
data
=
xr
.
open_mfdataset
(
paths
=
self
.
dataset_search_str
,
combine
=
'
nested
'
,
concat_dim
=
self
.
time_dim_name
,
parallel
=
True
,
decode_cf
=
False
,
preprocess
=
self
.
preprocess_fkt_for_loader
,
)
data
=
xr
.
decode_cf
(
data
)
parallel
=
True
,
preprocess
=
self
.
preprocess_fkt_for_loader
,
#decode_cf=False,
)
logging
.
info
(
f
"
Reading file(s):
{
self
.
dataset_search_str
}
"
)
#data = xr.decode_cf(data)
self
.
_data
=
data
self
.
_data
=
data
def
preprocess_fkt_for_loader
(
self
,
ds
):
def
preprocess_fkt_for_loader
(
self
,
ds
):
...
...
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