Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Climax
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
earth_observation_public
Climax
Commits
fef4fa2b
Commit
fef4fa2b
authored
3 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Check available pressure levels.
parent
5947e6cd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
climax/core/dataset.py
+9
-3
9 additions, 3 deletions
climax/core/dataset.py
with
9 additions
and
3 deletions
climax/core/dataset.py
+
9
−
3
View file @
fef4fa2b
...
...
@@ -12,7 +12,7 @@ import numpy as np
import
xarray
as
xr
# locals
from
climax.core.constants
import
ERA5_VARIABLES
,
PROJECTION
,
ERA5_PLEVELS
from
climax.core.constants
import
ERA5_VARIABLES
,
PROJECTION
from
pysegcnn.core.utils
import
search_files
...
...
@@ -43,6 +43,8 @@ class NetCDFDataset(EoDataset):
def
__init__
(
self
,
X
,
y
,
dim
=
'
time
'
):
# TODO: check if conversion to array is more efficient
# NetCDF dataset containing predictor variables (ERA5)
self
.
X
=
X
...
...
@@ -75,7 +77,7 @@ class ERA5Dataset(EoDataset):
self
.
variables
=
[
var
for
var
in
variables
if
var
in
ERA5_VARIABLES
]
# pressure levels
self
.
plevels
=
plevels
if
plevels
is
not
None
else
ERA5_PLEVELS
self
.
plevels
=
plevels
def
merge
(
self
,
**
kwargs
):
# search dataset for each variable in root directory
...
...
@@ -91,8 +93,12 @@ class ERA5Dataset(EoDataset):
# check if the dataset is defined on pressure levels or single
# levels
if
'
level
'
in
ds
.
dims
:
# check specified pressure levels to retrieve
levels
=
(
self
.
plevels
if
self
.
plevels
is
not
None
else
ds
.
level
.
values
)
# iterate over pressure levels to use
for
pl
in
self
.
p
levels
:
for
pl
in
levels
:
# check if pressure level is available
if
pl
not
in
ds
.
level
:
continue
...
...
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