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
a693fd8a
Commit
a693fd8a
authored
3 years ago
by
Frisinghelli Daniel
Browse files
Options
Downloads
Patches
Plain Diff
Adjusted constant parameters.
parent
40ee4efa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
climax/core/cli.py
+64
-3
64 additions, 3 deletions
climax/core/cli.py
climax/core/constants.py
+4
-0
4 additions, 0 deletions
climax/core/constants.py
climax/main/config.py
+3
-0
3 additions, 0 deletions
climax/main/config.py
with
71 additions
and
3 deletions
climax/core/cli.py
+
64
−
3
View file @
a693fd8a
...
...
@@ -11,7 +11,7 @@ import pathlib
# locals
from
climax.core.constants
import
(
CORDEX_VARIABLES
,
CORDEX_EXPERIMENTS
,
EUROCORDEX_GCMS
,
EUROCORDEX_RCMS
,
CDO_RESAMPLING_MODES
)
CDO_RESAMPLING_MODES
,
ERA5_VARIABLES
)
# epilogue to display at the end of each parser
EPILOGUE
=
'
Author: Daniel Frisinghelli, daniel.frisinghelli@gmail.com
'
...
...
@@ -20,8 +20,8 @@ EPILOGUE = 'Author: Daniel Frisinghelli, daniel.frisinghelli@gmail.com'
LOGGER
=
logging
.
getLogger
(
__name__
)
# parser to preprocess Cordex data: climax.main.preprocess.py
def
preprocess_parser
():
# parser to preprocess Cordex data: climax.main.preprocess
_CORDEX
.py
def
preprocess_
cordex_
parser
():
# define command line argument parser
parser
=
argparse
.
ArgumentParser
(
...
...
@@ -118,3 +118,64 @@ def preprocess_parser():
.
format
(
default
)),
default
=
None
,
metavar
=
''
)
return
parser
# parser to preprocess ERA5 data: climax.main.preprocess_ERA5.py
def
preprocess_era5_parser
():
# define command line argument parser
parser
=
argparse
.
ArgumentParser
(
description
=
'
Reproject and resample ERA5 data to a target grid.
'
,
epilog
=
EPILOGUE
,
formatter_class
=
lambda
prog
:
argparse
.
RawDescriptionHelpFormatter
(
prog
,
max_help_position
=
50
,
indent_increment
=
2
))
# positional arguments
# positional argument: path to the target grid file
parser
.
add_argument
(
'
grid
'
,
type
=
pathlib
.
Path
,
help
=
'
Path to the target grid file.
'
)
# positional argument: path to search for Cordex NetCDF files
parser
.
add_argument
(
'
source
'
,
type
=
pathlib
.
Path
,
help
=
'
Path to search for ERA5 NetCDF files.
'
)
# positional argument: path to save the reprojected NetCDF files
parser
.
add_argument
(
'
target
'
,
type
=
pathlib
.
Path
,
help
=
'
Path to save the remapped ERA5 NetCDF files.
'
)
# optional arguments
# default values
default
=
'
(default: %(default)s)
'
# optional argument: name of the variable of interest
parser
.
add_argument
(
'
-var
'
,
'
--variable
'
,
type
=
str
,
help
=
'
Name of the variable of interest.
'
,
choices
=
ERA5_VARIABLES
,
default
=
None
,
nargs
=
'
+
'
,
metavar
=
''
)
# optional argument: resampling mode
parser
.
add_argument
(
'
-m
'
,
'
--mode
'
,
type
=
str
,
help
=
'
Resampling mode {}.
'
.
format
(
default
),
default
=
'
bilinear
'
,
choices
=
CDO_RESAMPLING_MODES
,
metavar
=
''
)
# optional argument: whether to overwrite files
parser
.
add_argument
(
'
-o
'
,
'
--overwrite
'
,
type
=
bool
,
help
=
'
Overwrite existing files {}.
'
.
format
(
default
),
default
=
False
,
nargs
=
'
?
'
,
const
=
True
,
metavar
=
''
)
# optional argument: whether to aggregate time periods of simulations
parser
.
add_argument
(
'
-a
'
,
'
--aggregate
'
,
type
=
bool
,
help
=
(
'
Aggregate time periods of ERA5 to a
'
'
single NetCDF file {}.
'
.
format
(
default
)),
default
=
False
,
nargs
=
'
?
'
,
const
=
True
,
metavar
=
''
)
# optional argument: dry run, print files which would be processed
parser
.
add_argument
(
'
-d
'
,
'
--dry-run
'
,
type
=
bool
,
help
=
(
'
Print files which would be processed {}.
'
.
format
(
default
)),
default
=
False
,
nargs
=
'
?
'
,
const
=
True
,
metavar
=
''
)
return
parser
This diff is collapsed.
Click to expand it.
climax/core/constants.py
+
4
−
0
View file @
a693fd8a
...
...
@@ -30,3 +30,7 @@ EUROCORDEX_RCMS = ['SMHI-RCA4', 'CLMcom-CCLM4-8-17',
# climate data operator (cdo) resampling modes
CDO_RESAMPLING_MODES
=
[
'
bilinear
'
,
'
conservative
'
]
# ERA5 variables to use for the downscaling
ERA5_VARIABLES
=
[
'
geopotential
'
,
'
temperature
'
,
'
u_component_of_wind
'
,
'
v_component_of_wind
'
,
'
specific_humidity
'
]
This diff is collapsed.
Click to expand it.
climax/main/config.py
+
3
−
0
View file @
a693fd8a
...
...
@@ -13,3 +13,6 @@ HERE = pathlib.Path(__file__).parent
# calibration period
P_CAL
=
(
datetime
.
datetime
.
strptime
(
'
1970-01-01
'
,
'
%Y-%m-%d
'
).
date
(),
datetime
.
datetime
.
strptime
(
'
2000-01-01
'
,
'
%Y-%m-%d
'
).
date
())
# path to ERA5 reanalysis data
ERA5_PATH
=
pathlib
.
Path
(
'
/mnt/CEPH_PROJECTS/FACT_CLIMAX/REANALYSIS/
'
)
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