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 5 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

index.md Outdated
@@ -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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll remove the sentence 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).. Another thing to note is that chunking is not really controlled by the user. CMOR will set chunking for variables but using netCDF4's default chunk size.

mydoc/mydoc_cmip6_validator.md Outdated Show resolved Hide resolved
mydoc/mydoc_cmip6_validator.md Show resolved Hide resolved
@@ -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 invoked 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
Collaborator Author

Choose a reason for hiding this comment

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

@durack1 Would cutting down the paragraph to the following be better?

Suggested change
* 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 invoked on-demand by setting flags in the table. [example](https://github.com/PCMDI/cmor/blob/main/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. 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

This text says one this "CMOR3 still produces NETCDF4 CLASSIC", and then says "Note: CMOR3 NOW output(s) NetCDF4 files by default."

So we need to remove the first one, as NetCDF3 is pretty much dead now..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@durack1 Have you taken a look at the proposed changes above? If you are fine with them, then I'll merge them, update the PDF, and merge into main.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry @mauzey1. Is it true that CMOR still "netCDF-4 classic model" (see here).If that is true, then much of the netCDF3 text is redundant. The last release of netCDF v3.6.3 was May 2008 (here), and it's almost impossible to find any references to it, let alone currently supported libraries

@mauzey1
Copy link
Collaborator Author

mauzey1 commented Jan 15, 2025

@durack1 I agree with listing other projects that use CMOR aside CMIP6 but I think we should make that a separate issue for another PR.

@durack1
Copy link
Contributor

durack1 commented Jan 15, 2025

@durack1 I agree with listing other projects that use CMOR aside CMIP6 but I think we should make that a separate issue for another PR.

Couldn't agree more - are you happy to do it (create an issue)?

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