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
f089fcbb
Commit
f089fcbb
authored
3 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Implemented download and preprocessing of ERA5 single level variables.
parent
05f9824c
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/main/preprocess/download_ERA5.py
+13
-8
13 additions, 8 deletions
climax/main/preprocess/download_ERA5.py
with
13 additions
and
8 deletions
climax/main/preprocess/download_ERA5.py
+
13
−
8
View file @
f089fcbb
...
...
@@ -12,13 +12,9 @@ import cdsapi
import
numpy
as
np
# locals
from
climax.core.constants
import
ERA5_VARIABLES
from
climax.core.constants
import
ERA5_P_VARIABLES
,
ERA5_VARIABLES
from
climax.main.config
import
ERA5_PATH
# ERA-5 product
product
=
'
reanalysis-era5-pressure-levels
'
product_type
=
'
reanalysis
'
# pressure levels
pressure_levels
=
[
'
850
'
,
'
500
'
]
...
...
@@ -26,15 +22,14 @@ pressure_levels = ['850', '500']
years
=
[
str
(
y
)
for
y
in
np
.
arange
(
1981
,
2011
)]
month
=
[
str
(
m
)
for
m
in
np
.
arange
(
1
,
13
)]
days
=
[
str
(
d
)
for
d
in
np
.
arange
(
1
,
32
)]
time
=
[
"
{:02d}:00
"
.
format
(
t
)
for
t
in
np
.
arange
(
0
,
24
)]
time
=
[
"
{:02d}:00
"
.
format
(
t
)
for
t
in
np
.
arange
(
0
,
24
)]
# area of interest (Alps): North, West, South, East
area
=
[
52
,
2
,
40
,
20
]
# ERA5 download configuration dictionary
CONFIG
=
{
'
product_type
'
:
product_type
,
'
pressure_level
'
:
pressure_levels
,
'
product_type
'
:
'
reanalysis
'
,
'
month
'
:
month
,
'
day
'
:
days
,
'
time
'
:
time
,
...
...
@@ -59,6 +54,16 @@ if __name__ == '__main__':
files
=
[
output
.
joinpath
(
'
_
'
.
join
([
'
ERA5
'
,
var
,
year
])
+
'
.nc
'
)
for
year
in
years
]
# check whether to download variable on pressure levels or single level
if
var
in
ERA5_P_VARIABLES
:
# download configuration: ERA5 variable on pressure levels
product
=
'
reanalysis-era5-pressure-levels
'
CONFIG
[
'
pressure_level
'
]
=
pressure_levels
# pressure levels
else
:
# download configuration: ERA5 variable on single level
product
=
'
reanalysis-era5-single-levels
'
CONFIG
.
pop
(
'
pressure_level
'
)
# remove pressure levels
# split the download to the different years: CDS API cannot handle
# requests over the whole time period
Parallel
(
n_jobs
=
min
(
len
(
years
),
os
.
cpu_count
()),
verbose
=
51
)(
...
...
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