-
Notifications
You must be signed in to change notification settings - Fork 46
Add preliminary CMIP7 support #2935
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
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5990c16
Initial CMIP7 support
bouweandela 19a6c1b
Automatically add realm
bouweandela 412ccb3
Improve dataset summary: drop activity and add cmip7 facets
bouweandela 522261c
Add docstring
bouweandela fc61235
Add documentation on facet mappings
bouweandela ff07175
Improve docs
bouweandela 3469843
Add another link in the docs
bouweandela c2d9f05
Update docs
bouweandela c2eb454
Update CMOR tables to Data Request 1.2.2.3
bouweandela d8e2b11
Fix docs
bouweandela f88c116
Improve support for wildcards and supplementary variables
bouweandela f744fb1
Avoid issue extracting timerange when frequency is not known yet
bouweandela 0c28f00
Update test to use correct type
bouweandela c62f99c
Add tests for esmvalcore.cmor.table
bouweandela 6cb6a17
Add a dataset test
bouweandela 2c9f97f
Add more tests
bouweandela 4f03d57
Merge branch 'main' of github.com:ESMValGroup/ESMValCore into initialβ¦
bouweandela 5e13989
Address review comments
bouweandela 2c5139c
Fix table formatting
bouweandela 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
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,66 @@ | ||
| .. _cmor_tables: | ||
|
|
||
| Variables and CMOR Tables | ||
| ========================= | ||
|
|
||
| ESMValCore has been designed to facilitate working with | ||
| `Earth System Model <https://www.climateurope.eu/earth-system-modeling-a-definition/>`__ | ||
| data, also known as climate model data. | ||
| To make it easy to compare and combine data from different climate models, | ||
| reanalysis datasets, and observational datasets, ESMValCore uses the standardized | ||
| variables from the | ||
| `CMOR tables <https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables>`_ | ||
| provided by the projects it supports. `CMOR <https://github.com/PCMDI/cmor>`__ | ||
| (Climate Model Output Rewriter) is a tool commonly used by climate modelling | ||
| centers to format their model output according to community standards. | ||
| The CMOR tables define the standardized variable names, units, | ||
| coordinates, and other metadata for various climate variables and are typically | ||
| compiled from a Data Request and a Controlled Vocabulary, e.g. the | ||
| `CMIP7 CMOR tables <https://github.com/WCRP-CMIP/cmip7-cmor-tables/>`__ are | ||
| based on the | ||
| `CMIP7 Data Request <https://wcrp-cmip.org/cmip-phases/cmip7/cmip7-data-request/>`__, | ||
| and the | ||
| `CMIP7 Controlled Vocabulary <https://github.com/WCRP-CMIP/CMIP7-CVs>`__ | ||
| . | ||
| ESMValCore comes bundled with several CMOR tables, which are stored in the directory | ||
| `esmvalcore/cmor/tables <https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables>`_. | ||
| It is possible to :ref:`configure which CMOR tables are used by ESMValCore <cmor_table_configuration>`. | ||
|
|
||
| The :ref:`facets <facets>` ``project``, ``mip``, ``short_name``, and optionally | ||
| ``branding_suffix``, uniquely determine the variable to use. These facets are | ||
| used to look up the variable in the CMOR table for the project. | ||
| Compliance with the variable definition from the CMOR table is checked when data is | ||
| loaded, to avoid unexpected results or errors during data processing. The strictness | ||
| of these checks can be :ref:`configured <cmor_check_strictness>`. | ||
| For example, the facets ``project: CMIP6, mip: Amon, short_name: tas`` | ||
| define the near-surface air temperature variable in the CMIP6 Amon table: | ||
|
|
||
| .. literalinclude:: ../../esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Amon.json | ||
| :start-at: "tas": { | ||
| :end-at: }, | ||
| :caption: The ``tas`` variable definition in the CMIP6 Amon table at `esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Amon.json <https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Amon.json>`__. | ||
|
|
||
| In some cases the ``short_name`` (called ``out_name`` in the CMOR tables) of a | ||
| variable may differ from the name used as a key in the CMOR table. | ||
| This is always the case for CMIP7, where the | ||
| `branded variable name <https://wcrp-cmip.github.io/cmip7-guidance/CMIP7/branded_variables/>`__ | ||
| is used, which is composed of the ``short_name`` followed | ||
| by an underscore and the ``branding_suffix``. For example, the facets | ||
| ``project: CMIP7, mip: atmos, short_name: tas, branding_suffix: tavg-h2m-hxy-u`` | ||
|
schlunma marked this conversation as resolved.
|
||
| select one of the near-surface air temperature variables in the CMIP7 atmos table: | ||
|
|
||
| .. literalinclude:: ../../esmvalcore/cmor/tables/cmip7/Tables/CMIP7_atmos.json | ||
| :start-at: "tas_tavg-h2m-hxy-u": { | ||
| :end-at: }, | ||
| :caption: One of the ``tas`` variable definitions in the CMIP7 atmos table at `esmvalcore/cmor/tables/cmip7/Tables/CMIP7_atmos.json <https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables/cmip7/Tables/CMIP7_atmos.json>`__. | ||
|
|
||
| For other projects, the facet ``branding_suffix`` can also be used to distinguish | ||
| between variables from the same CMOR table that share the same ``short_name``, | ||
| but differ in other aspects, even though these projects do not use branded variables. | ||
| For example, the ``ch4Clim`` entry in the CMIP6 Amon table can be selected in | ||
| the recipe by specifying ``project: CMIP6, mip: Amon, short_name: ch4, branding_suffix: Clim``: | ||
|
|
||
| .. literalinclude:: ../../esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Amon.json | ||
| :start-at: "ch4Clim": { | ||
| :end-at: }, | ||
| :caption: One of the ``ch4`` variable definitions in the CMIP6 Amon table at `esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Amon.json <https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Amon.json>`__. | ||
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,179 @@ | ||
| .. _facets: | ||
|
|
||
| Facets | ||
| ====== | ||
|
|
||
| A facet is a key-value pair that describes a certain property of a dataset and | ||
| enables `faceted search <https://en.wikipedia.org/wiki/Faceted_search>`_, for | ||
| example as provided by `ESGF <https://esgf-node.ornl.gov/search>`__. | ||
| The facets used on ESGF are closely related to the global attributes defined by | ||
| the `controlled vocubulary <https://en.wikipedia.org/wiki/Controlled_vocabulary>`__ | ||
| used by the various "project"s hosted on ESGF. A "project" is a collection of | ||
| datasets that share certain properties, e.g. | ||
| `CMIP7 <https://wcrp-cmip.org/cmip-phases/cmip7/>`__ is a project. | ||
| Each project has its own set of facets that are relevant for that project. | ||
| The documents linked below provide an overview of the official facets for | ||
| various projects. They also provide a reference directory structure and file naming | ||
| convention based on facets, which is used to organise data on local filesystems. | ||
|
|
||
| ESMValCore uses "facets" to search for and define input data, both in the | ||
| :ref:`recipe <recipe>` and in the :class:`~esmvalcore.dataset.Dataset` object. | ||
| This allows specifying data without relying on e.g. file names or directory | ||
| structures, which may vary between computers. ESMValCore uses its own set of | ||
| facets, which is consistent across all projects it supports. | ||
|
|
||
| Here is a mapping from the facet names used in ESMValCore to the corresponding | ||
| project specific facet names used on ESGF. | ||
|
|
||
| CMIP7 | ||
| ----- | ||
|
|
||
| `Official CMIP7 facets <https://wcrp-cmip.github.io/cmip7-guidance/CMIP7/global_attributes/>`__. | ||
|
|
||
| .. note:: | ||
| This mapping is prelimary as no CMIP7 data bas been published on ESGF yet. | ||
|
|
||
| +----------------------+---------------------------+ | ||
| | ESMValCore facet | ESGF facet | | ||
| +======================+===========================+ | ||
| | ``activity`` | ``activity_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``branding_suffix`` | ``branding_suffix`` | | ||
| +----------------------+---------------------------+ | ||
| | ``dataset`` | ``source_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``ensemble`` | ``variant_label`` | | ||
| +----------------------+---------------------------+ | ||
| | ``exp`` | ``experiment_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``frequency`` | ``frequency`` | | ||
| +----------------------+---------------------------+ | ||
| | ``grid`` | ``grid_label`` | | ||
| +----------------------+---------------------------+ | ||
| | ``institute`` | ``institution_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``realm`` | ``realm`` | | ||
| +----------------------+---------------------------+ | ||
| | ``region`` | ``region`` | | ||
| +----------------------+---------------------------+ | ||
| | ``project`` | ``project`` / ``mip_era`` | | ||
| +----------------------+---------------------------+ | ||
| | ``short_name`` | ``variable_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``version`` | ``version`` | | ||
| +----------------------+---------------------------+ | ||
|
|
||
| CMIP6 | ||
| ----- | ||
|
|
||
| `Official CMIP6 facets <https://wcrp-cmip.github.io/WGCM_Infrastructure_Panel/Papers/CMIP6_global_attributes_filenames_CVs_v6.2.7.pdf>`__. | ||
|
|
||
| +----------------------+---------------------------+ | ||
| | ESMValCore facet | ESGF facet | | ||
| +======================+===========================+ | ||
| | ``activity`` | ``activity_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``dataset`` | ``source_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``ensemble`` | ``member_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``exp`` | ``experiment_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``frequency`` | ``frequency`` | | ||
| +----------------------+---------------------------+ | ||
| | ``grid`` | ``grid_label`` | | ||
| +----------------------+---------------------------+ | ||
| | ``institute`` | ``institution_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``mip`` | ``table_id`` | | ||
| +----------------------+---------------------------+ | ||
| | ``realm`` | ``realm`` | | ||
| +----------------------+---------------------------+ | ||
| | ``project`` | ``project`` / ``mip_era`` | | ||
| +----------------------+---------------------------+ | ||
| | ``short_name`` | ``variable_id`` | | ||
| +----------------------+---------------------------+ | ||
|
|
||
| CMIP5 | ||
| ----- | ||
|
|
||
| `Official CMIP5 facets <https://pcmdi.github.io/mips/cmip5/docs/CMIP5_output_metadata_requirements.pdf>`__. | ||
| Note that there appear to be differences between the official facets and those | ||
| used on ESGF. Below we present the facets used on ESGF. | ||
|
|
||
| +----------------------+-----------------------+ | ||
| | ESMValCore facet | ESGF facet | | ||
| +======================+=======================+ | ||
| | ``dataset`` | ``model`` | | ||
| +----------------------+-----------------------+ | ||
| | ``ensemble`` | ``ensemble`` | | ||
| +----------------------+-----------------------+ | ||
| | ``exp`` | ``experiment`` | | ||
| +----------------------+-----------------------+ | ||
| | ``frequency`` | ``time_frequency`` | | ||
| +----------------------+-----------------------+ | ||
| | ``institute`` | ``institute`` | | ||
| +----------------------+-----------------------+ | ||
| | ``mip`` | ``cmor_table`` | | ||
| +----------------------+-----------------------+ | ||
| | ``realm`` | ``realm`` | | ||
| +----------------------+-----------------------+ | ||
| | ``product`` | ``product`` | | ||
| +----------------------+-----------------------+ | ||
| | ``project`` | ``project`` | | ||
| +----------------------+-----------------------+ | ||
| | ``short_name`` | ``variable`` | | ||
| +----------------------+-----------------------+ | ||
|
|
||
| CMIP3 | ||
| ----- | ||
|
|
||
| +----------------------+-----------------------+ | ||
| | ESMValCore facet | ESGF facet | | ||
| +======================+=======================+ | ||
| | ``dataset`` | ``model`` | | ||
| +----------------------+-----------------------+ | ||
| | ``ensemble`` | ``ensemble`` | | ||
| +----------------------+-----------------------+ | ||
| | ``exp`` | ``experiment`` | | ||
| +----------------------+-----------------------+ | ||
| | ``frequency`` | ``time_frequency`` | | ||
| +----------------------+-----------------------+ | ||
| | ``short_name`` | ``variable`` | | ||
| +----------------------+-----------------------+ | ||
|
|
||
| CORDEX | ||
| ------- | ||
|
|
||
| `Official CORDEX-CMIP5 facets <https://zenodo.org/records/15223120>`__. | ||
| Note that there appear to be differences between the official facets and those | ||
| used on ESGF. Below we present the facets used on ESGF. | ||
|
|
||
| +----------------------+-----------------------+ | ||
| | ESMValCore facet | ESGF facet | | ||
| +======================+=======================+ | ||
| | ``dataset`` | ``rcm_name`` | | ||
| +----------------------+-----------------------+ | ||
| | ``driver`` | ``driving_model`` | | ||
| +----------------------+-----------------------+ | ||
| | ``domain`` | ``domain`` | | ||
| +----------------------+-----------------------+ | ||
| | ``ensemble`` | ``ensemble`` | | ||
| +----------------------+-----------------------+ | ||
| | ``exp`` | ``experiment`` | | ||
| +----------------------+-----------------------+ | ||
| | ``frequency`` | ``time_frequency`` | | ||
| +----------------------+-----------------------+ | ||
| | ``institute`` | ``institute`` | | ||
| +----------------------+-----------------------+ | ||
| | ``short_name`` | ``variable`` | | ||
| +----------------------+-----------------------+ | ||
|
|
||
| obs4MIPs | ||
| -------- | ||
|
|
||
| `Official obs4MIPs facets <https://doi.org/10.5281/zenodo.11500473>`__. | ||
| Note that obs4MIPs first followed the CMIP5 conventions before switching to | ||
| the CMIP6 conventions. That means that both conventions are in use depending on | ||
| when a particular dataset was published. See the CMIP5 and CMIP6 tables above | ||
| for the mappings. |
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,17 @@ | ||
| .. _reference: | ||
|
|
||
| Reference guides | ||
| ================ | ||
|
|
||
| .. note:: | ||
| This is work in progress as we are currently working on adding more | ||
| reference guides to this section. | ||
|
|
||
| For a more detailed overview of what reference guides should cover, | ||
| you can head to the `Diataxis page <https://diataxis.fr/reference/>`__. | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 1 | ||
|
|
||
| Variables and CMOR Tables <cmor_tables> | ||
| Facets <facets> |
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
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.