-
Notifications
You must be signed in to change notification settings - Fork 44
Added CESM2 CMORizer #1678
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
Merged
Merged
Added CESM2 CMORizer #1678
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d1bb527
First prototype of CESM2 on-the-fly CMORizer
schlunma 79da9d0
Merge branch 'main' into cmorize_cesm
schlunma f1b5834
Used new NativeDatasetFix class for CESM2 CMORizer
schlunma cb70031
Added tests for input/output filenames for ICON and EMAC CMORizer
schlunma 94237df
Merge branch 'expand_emac_icon_tests' into cmorize_cesm
schlunma 4025fbe
Adapted input files and dirs for CESM
schlunma c124ebf
Added tests for input/output filenames of CESM
schlunma 13d8c55
Added tests for CESM2 on-the-fly CMORizer
schlunma bfd2ed5
Added tests for output filenames of CESM2
schlunma 59b1fc4
Added doc for CESM2 on-the-fly CMORizer
schlunma a5eb230
Fixed typo in doc
schlunma 20d3959
Merge remote-tracking branch 'origin/main' into cmorize_cesm
schlunma 23eb429
Added warning about supported variables for CESM on-the-fly CMORizer
schlunma 5815f99
Made clear that CESM on-the-fly CMORizer is prototype
schlunma b2af170
Updated ICON example in native dataset fix doc
schlunma 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,30 @@ | ||
| # Extra facets for native CESM model output | ||
|
|
||
| # Notes: | ||
| # - All facets can also be specified in the recipes. The values given here are | ||
| # only defaults. | ||
| # - The facets ``gcomp``, ``scomp``, ``string``, ``tdir``, and ``tperiod`` have | ||
| # to be specified in the recipe if they are not given here and default DRS is | ||
| # used. | ||
|
|
||
| # A complete list of supported keys is given in the documentation (see | ||
| # ESMValCore/doc/quickstart/find_data.rst). | ||
| --- | ||
|
|
||
| CESM2: | ||
|
|
||
| '*': | ||
| # Optional facets for every variable | ||
| # It is necessary to define them here to allow multiple file/dir name | ||
| # conventions, see | ||
| # https://www.cesm.ucar.edu/models/cesm2/naming_conventions.html | ||
| '*': | ||
| string: '' | ||
| tdir: '' | ||
| tperiod: '' | ||
|
|
||
| # Default facets for variables | ||
| tas: | ||
| raw_name: TREFHT | ||
| gcomp: atm | ||
| scomp: cam |
This file contains hidden or 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 hidden or 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 hidden or 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
Empty file.
This file contains hidden or 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,51 @@ | ||
| """On-the-fly CMORizer for CESM2. | ||
|
|
||
| Warning | ||
| ------- | ||
| The support for native CESM output is still experimental. Currently, only one | ||
| variable (`tas`) is fully supported. Other 2D variables might be supported by | ||
| specifying appropriate facets in the recipe or extra facets files (see | ||
| doc/quickstart/find_data.rst for details). 3D variables are currently not | ||
| supported. | ||
|
|
||
| To add support for more variables, expand the extra facets file | ||
| (esmvalcore/_config/extra_facets/cesm-mappings.yml) and/or add classes to this | ||
| file for variables that need more complex fixes (see | ||
| esmvalcore/cmor/_fixes/emac/emac.py for examples). | ||
|
|
||
| """ | ||
|
|
||
| import logging | ||
|
|
||
| from iris.cube import CubeList | ||
|
|
||
| from ..native_datasets import NativeDatasetFix | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class AllVars(NativeDatasetFix): | ||
| """Fixes for all variables.""" | ||
|
|
||
| # Dictionary to map invalid units in the data to valid entries | ||
| INVALID_UNITS = { | ||
| 'fraction': '1', | ||
| } | ||
|
|
||
| def fix_metadata(self, cubes): | ||
| """Fix metadata.""" | ||
| cube = self.get_cube(cubes) | ||
|
|
||
| # Fix time, latitude, and longitude coordinates | ||
| # Note: 3D variables are currently not supported | ||
| self.fix_regular_time(cube) | ||
| self.fix_regular_lat(cube) | ||
| self.fix_regular_lon(cube) | ||
|
|
||
| # Fix scalar coordinates | ||
| self.fix_scalar_coords(cube) | ||
|
|
||
| # Fix metadata of variable | ||
| self.fix_var_metadata(cube) | ||
|
|
||
| return CubeList([cube]) | ||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.