Skip to content
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

Python example of grid coordinates and updates to GitHub links #146

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mauzey1
Copy link
Collaborator

@mauzey1 mauzey1 commented Jan 14, 2025

Resolves PCMDI/cmor#766

Adds example code and NetCDF output demonstrating the use of cmor.grid.

This was made in response to @ilaflott issue at PCMDI/cmor#766.

This PR also contains some changes to GitHub links. The branch name master is replaced with main for links to the CMOR repo. Links that point to sections of CMIP6_CV.py in the cmip6-cmor-tables repo have been replaced with permalinks to prevent the linked section from shifting when the CV is changed.

@mauzey1 mauzey1 requested a review from durack1 January 14, 2025 16:42
Copy link
Contributor

@durack1 durack1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to start pulling out the direct references to the CMIP6 project, and rather start listing projects using CMOR. CMIP6 is effectively closed for registrations, with new models/experiments being defined in CMIP6Plus_CVs for now, and CMIP7_CVs online in the coming months. Then there is input4MIPs and obs4MIPs, amongst other projects (DRCDP, etc) using the software

@@ -21,7 +21,7 @@ CMOR output has the following characteristics:

* For metadata, different MIPs may have different requirements, but these are accommodated by CMOR, within the constraints of the CF convention and as specified in the MIP tables (e.g. [CMIP6 MIP tables](https://github.com/PCMDI/cmip6-cmor-tables)).

* CMOR can rely on NetCDF4 [See unidata web page](http://www.unidata.ucar.edu/software/netcdf) to write the output files and can take advantage of its compression and chunking capabilities. In that case, compression is controlled with the MIP tables using the shuffle, deflate and deflate_level attributes, default values are respectively 0, 0 and 0(disable). It is worth noting that even when using NetCDF4, CMOR3 still produces NETCDF4 CLASSIC formatted output. This allows the file generated to be readable by any application that can read NetCDF3 provided they are re-linked against NetCDF4. When using the NetCDF4 library it is also still possible to write files that can be read through the NetCDF3 library by adding "_3" to the appropriate cmor_setup argument (see below). Note: CMOR3 **NOW** output NetCDF4 files by default. For CMIP6, the NetCDF4/NC_CLASSIC_Model mode is used (and chunking is **NOW** invoked... shuffle and deflation can be invoke on-demand by setting flags in the table. [example](https://github.com/PCMDI/cmor/blob/master/Test/speed_test_table_A#L1691-L1693)).
* CMOR can rely on NetCDF4 [See unidata web page](http://www.unidata.ucar.edu/software/netcdf) to write the output files and can take advantage of its compression and chunking capabilities. In that case, compression is controlled with the MIP tables using the shuffle, deflate and deflate_level attributes, default values are respectively 0, 0 and 0(disable). It is worth noting that even when using NetCDF4, CMOR3 still produces NETCDF4 CLASSIC formatted output. This allows the file generated to be readable by any application that can read NetCDF3 provided they are re-linked against NetCDF4. When using the NetCDF4 library it is also still possible to write files that can be read through the NetCDF3 library by adding "_3" to the appropriate cmor_setup argument (see below). Note: CMOR3 **NOW** output NetCDF4 files by default. For CMIP6, the NetCDF4/NC_CLASSIC_Model mode is used (and chunking is **NOW** invoked... shuffle and deflation can be invoke on-demand by setting flags in the table. [example](https://github.com/PCMDI/cmor/blob/main/Test/speed_test_table_A#L1691-L1693)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compression isn't controlled in the MIP tables - rather this would be the user input, no?

Note: CMOR3 Now output s NetCDF4 file by default (missing s)

..invoke d on demand.. (missing d)

@@ -54,14 +54,14 @@ where:

PrePARE will verify that all attributes in the input file are present and conform to CMIP6 for publication into ESGF. We also recommand running the python program [cfchecker](https://pypi.python.org/pypi/cfchecker) created by the University of Reading in the UK to confirm that your file is CF-1 compliant.

* In order to validate all CMIP6 required attributes by PrePARE, a [Controlled Vocabulary file](https://github.com/PCMDI/cmip6-cmor-tables/blob/master/Tables/CMIP6_CV.json) is read by the program where a JSON dictionnary called ["required_global_attributes"](https://github.com/PCMDI/cmip6-cmor-tables/blob/master/Tables/CMIP6_CV.json#L3) point to a list of strings. Each element of that list corresponds to a global attribute.
* PrePARE can also use regular expressions to validate the value of the some global attributes. Here is an [example](https://github.com/PCMDI/cmip6-cmor-tables/blob/master/Tables/CMIP6_CV.json#L6343-L6344) used for variant_label.
* In order to validate all CMIP6 required attributes by PrePARE, a [Controlled Vocabulary file](https://github.com/PCMDI/cmip6-cmor-tables/blob/main/Tables/CMIP6_CV.json) is read by the program where a JSON dictionnary called ["required_global_attributes"](https://github.com/PCMDI/cmip6-cmor-tables/blob/a46dcbf17ec5e11af23dc2d55107f5e52afbcade/Tables/CMIP6_CV.json#L3) point to a list of strings. Each element of that list corresponds to a global attribute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, a (extra space)
dictionnary (typo extra n)
point s to a list of strings (missing s)


* Institutions and institution_ids need to be registered into a list. PrePARE will only accept institutions which have been pre-registered for CMIP6 publication into ESGF. Click [here](https://github.com/PCMDI/cmip6-cmor-tables/blob/master/Tables/CMIP6_CV.json#L65) for the list of institutions. If you wish to register your institution write to the [cmor mailing list](mailto:[email protected]).
* Institutions and institution_ids need to be registered into a list. PrePARE will only accept institutions which have been pre-registered for CMIP6 publication into ESGF. Click [here](https://github.com/PCMDI/cmip6-cmor-tables/blob/a46dcbf17ec5e11af23dc2d55107f5e52afbcade/Tables/CMIP6_CV.json#L74) for the list of institutions. If you wish to register your institution write to the [cmor mailing list](mailto:[email protected]).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registering an institution will require engagement with the appropriate project_CVs repo, e.g. CMIP6Plus_CVs, CMIP7_CVs, input4MIPs_CVs, and obs4MIPs-cmor-tables (which will migrate to obs4MIPs_CVs once we have all the tables etc in place)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HIGHLY DESIRED: python cmor example for variables on native ocean tripolar grid
2 participants