-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on-the-fly cmoriser for ACCESS native data #2430
Merged
Merged
Changes from 113 commits
Commits
Show all changes
130 commits
Select commit
Hold shift + click to select a range
b774a36
branch for access live cmoriser
5acf65c
update simple version for live cmoriser
e7277a0
fix issue with multi-model-statistics
a0a05bc
comments added, ready for pull request
a32a48f
add packages in environment.yml
efcea11
change file name
9c0c9b8
reformat
f98406d
change class name to CapWords convention
2b5f8d5
Update environment.yml
rhaegar325 8043643
Update access_esm.py
rhaegar325 a86e1d9
reformat
c8bc262
reformat
f389559
summary line and description
7815a07
reformat
6db0088
reformat
4018368
reformat
0e864b6
reformat
200e2d6
update documentation
803c544
update documentation
fbfefdc
update documentation
88047fc
update documentation
0cd3498
Update find_data.rst
rbeucher 7cd6cf8
update config-developer.yml
7c91b6c
restore some changes
b446f6f
add test for cmoriser
9a0104f
reformat test_access_esm.py
64054ba
reformat test_access_esm.py
b8c6057
reformat test_access_esm.py
869c481
reformat esmvalcore/_task.py
6885d9a
add access test data
8cc0f3b
change datapath
c803837
fix _fix
d2d1da3
test for access cmoriser
013d5f0
test for access cmoriser
b116bfc
test for access cmoriser
c371ba0
test for access cmoriser
84fe2ed
Merge branch 'main' into access-live-cmoriser
rbeucher 6d80f5f
test for access cmoriser
a566cfd
test for access cmoriser
b666121
test for access cmoriser
f7fb9d7
test for access cmoriser
97acf57
add author name
645a203
Merge branch 'main' into access-live-cmoriser
rhaegar325 5f587df
clean code
f10b23c
Merge branch 'main' into access-live-cmoriser
rhaegar325 fb3ef3f
slitely change the import line
fdaf89d
use extra_facets
857b9d1
follow chnage request
1753b8d
follow chnage request
b0e1400
follow chnage request
7a06b34
follow chnage request
7f2ffeb
follow chnage request
24ef703
follow chnage request
c5c7393
change test file
4569cf5
fix height value
cadd99e
change docs
42ec653
change docs
7422346
add modeling_realm to extra_facet
41c6530
add modeling_realm to extra_facet
c92373d
add modeling_realm to extra_facet
fe5e4d6
fix output_file
fecb98b
fix output_file
8f744ff
add more variables to live-cmoriser
1456249
add more variables to live-cmoriser
bd3769e
add more available variables for cmoriser
rhaegar325 e160394
add more available variables for cmoriser
rhaegar325 573b4f1
add test
rhaegar325 f7081ba
add test
rhaegar325 b5143bd
Update doc/quickstart/find_data.rst
rhaegar325 08722f0
fix test
rhaegar325 8e89122
fix test
rhaegar325 2b93eb3
fix test
rhaegar325 8743481
fix test
rhaegar325 e909bf4
fix test
rhaegar325 21481a3
fix test
rhaegar325 17789cb
fix test
rhaegar325 2ee9aa0
fix test
rhaegar325 320ec83
fix test
rhaegar325 8ab57f7
fix test
rhaegar325 66b7d7e
fix test
rhaegar325 f29e18d
fix test
rhaegar325 442b2db
fix test
rhaegar325 7022df1
fix test
rhaegar325 151642e
remove eval()
rhaegar325 2f500ea
remove eval()
rhaegar325 5d6d519
remove eval()
rhaegar325 4f26996
Update esmvalcore/cmor/_fixes/access/access_esm.py
rhaegar325 814ece5
Update doc/quickstart/find_data.rst
rhaegar325 d08ae67
Update doc/quickstart/find_data.rst
rhaegar325 0451b7d
Update esmvalcore/cmor/_fixes/access/access_esm.py
rhaegar325 18ceca5
Update esmvalcore/cmor/_fixes/access/access_esm.py
rhaegar325 e15236e
fix format
rhaegar325 dcb13a7
change extra_facets
rhaegar325 1d3a0cf
change institude to dataset
rhaegar325 bac5051
change institude to dataset
rhaegar325 44af431
fix filename
rhaegar325 1106514
fix filename
rhaegar325 5a837e5
fix filename
rhaegar325 04921ea
fix filename
rhaegar325 9105512
add condition before fix_height_value
rhaegar325 ce60ea0
fix test
rhaegar325 41aeee0
fix test
rhaegar325 ef3e7de
Update doc/quickstart/find_data.rst
rhaegar325 b36738d
Update doc/quickstart/find_data.rst
rhaegar325 07519cb
fix test
rhaegar325 475f4b8
fix test
rhaegar325 5fd5b64
fix doc
rhaegar325 862d318
fix doc and test
rhaegar325 70d4258
fix test
rhaegar325 cb87ce6
fix test
rhaegar325 155c7cc
fix test
rhaegar325 71252bd
fix test
rhaegar325 f429566
fix test
rhaegar325 d48dac9
change class structure of cmoriser
rhaegar325 043b229
change class structure of cmoriser
rhaegar325 ab151ab
change class structure of cmoriser
rhaegar325 78e9a68
change class structure of cmoriser
rhaegar325 0e97c34
change class structure of cmoriser
rhaegar325 f033eea
change class structure of cmoriser
rhaegar325 0f2ff15
change class structure of cmoriser
rhaegar325 43279b0
change class structure of cmoriser
rhaegar325 bc69800
fix test
rhaegar325 f750d5a
fix test
rhaegar325 81be7d3
fix test
rhaegar325 fdf9f56
fix test
rhaegar325 18d31cc
fix class structure
rhaegar325 7370733
Move fix_height method to Tas class
rbeucher c5acc53
Fix blank spaces
rbeucher 54caba7
rename to fix_data
rhaegar325 987bdd9
fix function name
rhaegar325 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -564,6 +564,64 @@ explained in :ref:`extra_facets`, and which content is :download:`available here | |
</../esmvalcore/config/extra_facets/ipslcm-mappings.yml>`. These multi-variable | ||
files must also undergo some data selection. | ||
|
||
.. _read_access-esm: | ||
|
||
ACCESS-ESM | ||
^^^^^^^^^^ | ||
|
||
ESMValTool can read native `ACCESS-ESM <https://research.csiro.au/access/about/esm1-5/>`__ | ||
model output. | ||
|
||
.. warning:: | ||
|
||
This is the first version of ACCESS-ESM CMORizer for ESMValCore. Currently, | ||
Supported variables: ``pr``, ``ps``, ``psl``, ``rlds``, ``tas``, ``ta``, ``va``, | ||
``ua``, ``zg``, ``hus``, ``clt``, ``rsus``, ``rlus``. | ||
|
||
The default naming conventions for input directories and files for ACCESS output are | ||
|
||
* input directories: ``{institute}/{sub_dataset}/{exp}/{modeling_realm}/netCDF`` | ||
* input files: ``{sub_dataset}.{special_attr}-*.nc`` | ||
|
||
.. hint:: | ||
|
||
We only provide one default `input_dir` since this is how ACCESS-ESM native data was | ||
stored on NCI. Users can modify this path in the :ref:`config-developer` to match their local file structure. | ||
|
||
|
||
Thus, example dataset entries could look like this: | ||
|
||
.. code-block:: yaml | ||
|
||
dataset: | ||
- {project: ACCESS, mip: Amon, dataset:ACCESS_ESM1_5, sub_dataset: HI-CN-05, | ||
exp: history, modeling_realm: atm, special_attr: pa, start_year: 1986, end_year: 1986} | ||
|
||
|
||
Similar to any other fix, the ACCESS-ESM fix allows the use of :ref:`extra | ||
facets<extra_facets>`. | ||
By default, the file :download:`access-mappings.yml | ||
</../esmvalcore/config/extra_facets/access-mappings.yml>` is used for that | ||
purpose. | ||
For some variables, extra facets are necessary; otherwise ESMValCore cannot | ||
read them properly. | ||
Supported keys for extra facets are: | ||
|
||
==================== ====================================== ================================= | ||
rhaegar325 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Key Description Default value if not specified | ||
==================== ====================================== ================================= | ||
``raw_name`` Variable name of the variable in the CMOR variable name of the | ||
raw input file corresponding variable | ||
``modeling_realm`` Realm attribute include `atm`, `ice` No default (needs to be | ||
and `oce` specified in extra facets or | ||
recipe if default DRS is used) | ||
```special_attr`` A special attribute in the filename No default | ||
`ACCESS-ESM` raw data, it's related to | ||
frquency of raw data | ||
``sub_dataset`` Part of the ACCESS-ESM raw dataset No default | ||
root, need to specify if you want to | ||
use the cmoriser | ||
Comment on lines
+621
to
+623
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it part of the root ? I don't think so. careful to not create confusion with the rootpath in the config file. |
||
==================== ====================================== ================================= | ||
|
||
.. _data-retrieval: | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"""On-the-fly CMORizer for ACCESS-ESM.""" | ||
import logging | ||
|
||
from iris.cube import CubeList | ||
|
||
from esmvalcore.cmor._fixes.native_datasets import NativeDatasetFix | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class AllVars(NativeDatasetFix): | ||
"""Fixes for all variables.""" | ||
|
||
def fix_coord_system(self, cube): | ||
"""Delete coord_system to make CubeList able to merge.""" | ||
for dim in cube.dim_coords: | ||
if dim.coord_system is not None: | ||
dim.coord_system = None | ||
|
||
def fix_height_value(self, cube): | ||
"""Fix height value to make it comparable to other dataset.""" | ||
if cube.coord('height').points[0] != 2: | ||
cube.coord('height').points = [2] | ||
|
||
def calculate_data_from_multivar(self, cubes): | ||
"""Get cube before calculate from multiple variables.""" | ||
rawname_list = self.extra_facets.get('raw_name', | ||
self.vardef.short_name) | ||
var = [] | ||
for rawname in rawname_list: | ||
var.append(self.get_cube(cubes, rawname)) | ||
if self.vardef.short_name == 'rsus': | ||
cube = var[0] - var[1] | ||
if self.vardef.short_name == 'rlus': | ||
rhaegar325 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cube = var[0] - var[1] + var[2] - var[3] | ||
return cube | ||
|
||
def fix_metadata(self, cubes): | ||
"""Fix metadata. | ||
|
||
Parameters | ||
---------- | ||
cubes : iris.cube.CubeList | ||
Input cubes. | ||
|
||
Returns | ||
------- | ||
iris.cube.CubeList | ||
""" | ||
if isinstance( | ||
self.extra_facets.get('raw_name', self.vardef.short_name), | ||
list): | ||
cube = self.calculate_data_from_multivar(cubes) | ||
else: | ||
cube = self.get_cube(cubes) | ||
|
||
# Fix coordinates | ||
self.fix_scalar_coords(cube) | ||
self.fix_var_metadata(cube) | ||
self.fix_lon_metadata(cube) | ||
self.fix_lat_metadata(cube) | ||
|
||
# Fix coordinate 'height' | ||
if 'height_0' in [var.var_name for var in cube.coords()]: | ||
self.fix_height_metadata(cube) | ||
if self.vardef.short_name == 'tas': | ||
rhaegar325 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.fix_height_value(cube) | ||
# Fix coordinate 'pressure' | ||
if 'pressure' in [var.var_name for var in cube.coords()]: | ||
self.fix_plev_metadata(cube, coord='pressure') | ||
|
||
# Fix coord system | ||
self.fix_coord_system(cube) | ||
|
||
return CubeList([cube]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Extra facets for native ACCESS model output | ||
|
||
# A complete list of supported keys is given in the documentation (see | ||
# ESMValCore/doc/quickstart/find_data.rst). | ||
--- | ||
|
||
ACCESS_ESM: | ||
|
||
'*': | ||
|
||
tas: | ||
raw_name: fld_s03i236 | ||
modeling_realm: atm | ||
|
||
pr: | ||
raw_name: fld_s05i216 | ||
modeling_realm: atm | ||
|
||
ps: | ||
raw_name: fld_s00i409 | ||
modeling_realm: atm | ||
|
||
clt: | ||
raw_name: fld_s02i204 | ||
modeling_realm: atm | ||
|
||
psl: | ||
raw_name: fld_s16i222 | ||
modeling_realm: atm | ||
|
||
hus: | ||
raw_name: fld_s30i205 | ||
modeling_realm: atm | ||
|
||
zg: | ||
raw_name: fld_s30i207 | ||
modeling_realm: atm | ||
|
||
va: | ||
raw_name: fld_s30i202 | ||
modeling_realm: atm | ||
|
||
ua: | ||
raw_name: fld_s30i201 | ||
modeling_realm: atm | ||
|
||
ta: | ||
raw_name: fld_s30i204 | ||
modeling_realm: atm | ||
|
||
rlus: | ||
raw_name: | ||
- fld_s02i207 | ||
- fld_s02i201 | ||
- fld_s03i332 | ||
- fld_s02i205 | ||
modeling_realm: atm | ||
|
||
rlds: | ||
raw_name: fld_s02i207 | ||
modeling_realm: atm | ||
|
||
rsus: | ||
raw_name: | ||
- fld_s01i235 | ||
- fld_s01i201 | ||
modeling_realm: atm | ||
|
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is intentional or can be confusing as currently searching for published CMIP6 we use
dataset: ACCESS-ESM1-5
eg:does it make more sense to have
{ institute: ACCESS_ESM, dataset: ACCESS-ESM1-5 }
(switch them)?then change input_dir default above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look resolved to me.
ACCESS-ESM1-5
is not the institute, but rather the name of the model, right? So this probably would be a better fit fordataset
(you can then rename your fix file fromcmor/_fixes/access/access_esm.py
tocmor/_fixes/access/access_esm1_5.py
and possible extend this with more fix files if you want to look at other versions of the model. Then you can get rid ofinstitute
altogether.