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
779abc7b
Commit
779abc7b
authored
3 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Implemented using DEM slope and aspect.
parent
2f26c6e0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
climax/main/downscale_infer.py
+5
-4
5 additions, 4 deletions
climax/main/downscale_infer.py
climax/main/downscale_train.py
+4
-3
4 additions, 3 deletions
climax/main/downscale_train.py
with
9 additions
and
7 deletions
climax/main/downscale_infer.py
+
5
−
4
View file @
779abc7b
...
@@ -53,7 +53,7 @@ if __name__ == '__main__':
...
@@ -53,7 +53,7 @@ if __name__ == '__main__':
LogConfig
.
init_log
(
'
Initializing ERA5 predictors.
'
)
LogConfig
.
init_log
(
'
Initializing ERA5 predictors.
'
)
Era5
=
ERA5Dataset
(
ERA5_PATH
.
joinpath
(
'
ERA5
'
),
ERA5_PREDICTORS
,
Era5
=
ERA5Dataset
(
ERA5_PATH
.
joinpath
(
'
ERA5
'
),
ERA5_PREDICTORS
,
plevels
=
ERA5_PLEVELS
)
plevels
=
ERA5_PLEVELS
)
Era5_ds
=
Era5
.
merge
()
Era5_ds
=
Era5
.
merge
(
chunks
=-
1
)
# whether to use digital elevation model
# whether to use digital elevation model
if
DEM
:
if
DEM
:
...
@@ -63,9 +63,10 @@ if __name__ == '__main__':
...
@@ -63,9 +63,10 @@ if __name__ == '__main__':
# read elevation and compute slope and aspect
# read elevation and compute slope and aspect
dem
=
ERA5Dataset
.
dem_features
(
dem
,
{
'
time
'
:
Era5_ds
.
time
})
dem
=
ERA5Dataset
.
dem_features
(
dem
,
{
'
time
'
:
Era5_ds
.
time
})
# check wether to use slope and aspect
# read elevation and compute slope and aspect
if
not
DEM_FEATURES
:
dem
=
ERA5Dataset
.
dem_features
(
dem
=
dem
.
drop_vars
([
'
slope
'
,
'
aspect
'
])
dem
,
{
'
y
'
:
Era5_ds
.
y
,
'
x
'
:
Era5_ds
.
x
},
add_coord
=
{
'
time
'
:
Era5_ds
.
time
})
# add dem to set of predictor variables
# add dem to set of predictor variables
Era5_ds
=
xr
.
merge
([
Era5_ds
,
dem
])
Era5_ds
=
xr
.
merge
([
Era5_ds
,
dem
])
...
...
This diff is collapsed.
Click to expand it.
climax/main/downscale_train.py
+
4
−
3
View file @
779abc7b
...
@@ -61,7 +61,7 @@ if __name__ == '__main__':
...
@@ -61,7 +61,7 @@ if __name__ == '__main__':
LogConfig
.
init_log
(
'
Initializing ERA5 predictors.
'
)
LogConfig
.
init_log
(
'
Initializing ERA5 predictors.
'
)
Era5
=
ERA5Dataset
(
ERA5_PATH
.
joinpath
(
'
ERA5
'
),
ERA5_PREDICTORS
,
Era5
=
ERA5Dataset
(
ERA5_PATH
.
joinpath
(
'
ERA5
'
),
ERA5_PREDICTORS
,
plevels
=
ERA5_PLEVELS
)
plevels
=
ERA5_PLEVELS
)
Era5_ds
=
Era5
.
merge
()
Era5_ds
=
Era5
.
merge
(
chunks
=-
1
)
# initialize OBS predictand dataset
# initialize OBS predictand dataset
LogConfig
.
init_log
(
'
Initializing observations for predictand: {}
'
LogConfig
.
init_log
(
'
Initializing observations for predictand: {}
'
...
@@ -86,14 +86,15 @@ if __name__ == '__main__':
...
@@ -86,14 +86,15 @@ if __name__ == '__main__':
dem
=
search_files
(
DEM_PATH
,
'
^eu_dem_v11_stt.nc$
'
).
pop
()
dem
=
search_files
(
DEM_PATH
,
'
^eu_dem_v11_stt.nc$
'
).
pop
()
# read elevation and compute slope and aspect
# read elevation and compute slope and aspect
dem
=
ERA5Dataset
.
dem_features
(
dem
,
{
'
time
'
:
Era5_ds
.
time
})
dem
=
ERA5Dataset
.
dem_features
(
dem
,
{
'
y
'
:
Era5_ds
.
y
,
'
x
'
:
Era5_ds
.
x
},
add_coord
=
{
'
time
'
:
Era5_ds
.
time
})
# check wether to use slope and aspect
# check wether to use slope and aspect
if
not
DEM_FEATURES
:
if
not
DEM_FEATURES
:
dem
=
dem
.
drop_vars
([
'
slope
'
,
'
aspect
'
])
dem
=
dem
.
drop_vars
([
'
slope
'
,
'
aspect
'
])
# add dem to set of predictor variables
# add dem to set of predictor variables
LOGGER
.
info
(
'
HI
'
)
Era5_ds
=
xr
.
merge
([
Era5_ds
,
dem
])
Era5_ds
=
xr
.
merge
([
Era5_ds
,
dem
])
# initialize training data
# initialize training data
...
...
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