ioos / compliance-checker

Python tool to check your datasets against compliance standards
http://ioos.github.io/compliance-checker/
Apache License 2.0
104 stars 56 forks source link

Compliance checker is not handling CF 1.9 files correctly, and is complaining about CF 1.8 issues that are not correct #1093

Open mjbrodzik opened 2 weeks ago

mjbrodzik commented 2 weeks ago

Version of compliance checker running: 5.0.0

Describe the checker this affects: CF

Attach a minimal CDL or NetCDF file which is able to reproduce the issue

To Reproduce: Uploaded attached file, and ran the checker NSIDC0630_GRD_EASE2_N25km_GCOMW1_AMSR2_E_10.7H_20230627_v2.0.nc.gz using CF-1.8, since it is the most recent one to select.

Describe the issue below: A number of the reported issues are complaining about issues that should be updated for CF 1.9, specifically:

1) "??2.2 Data Types

CF 1.9 now allows unsigned types.

2) "??3.5 Flags

We only included a single flag value, and we are not sure why the checker is requiring this to be a list and not allowing it to be a single value. (This doesn't appear to be a difference between CF 1.8 and CF 1.9)

3) "??5.6 Horizontal Coordinate Reference Systems, Grid Mappings, Projections

We note that CF1.8 and CF1.8 both say: "To geo-reference data horizontally with respect to
the Earth, a grid mapping variable may be provided by the data variable, using
the grid_mapping attribute. If the coordinate variables for a horizontal grid
are not longitude and latitude, then a grid_mapping variable provides the
information required to derive longitude and latitude values for each grid
location. If no grid mapping variable is referenced by a data variable, then
longitude and latitude coordinate values shall be supplied in addition to the
required coordinates. For example, the Cartesian coordinates of a map projection
may be supplied as coordinate variables and, in addition, two-dimensional
latitude and longitude variables may be supplied via the coordinates attribute
on a data variable."

Since our data are projected, we interpreted this to mean that we could include x
and y as the coordinate variables (in projected meters), and together with the
"grid_mapping" attribute on each variable, this precluded the requirement to
also include 2D latitude/longitude coordinate variables. We think the checker is
not correctly interpreting the convention in this case.

4) "??2.6 Attributes

Our references global attribute contains a non-empty string, so we think this
might be a bug in the checker.

5) "??4.1 Latitude Coordinate

We think this is a further misunderstanding on the checker's understanding of the convention on horizontal
geo-referencing. Since the data are projected, the y(x) variable units have nothing to do with latitude(longitude) units.

6) "??8.1 Packed Data

We think this is a problem with the checker expecting not to find unsigned
types, which is legitimate for CF1.8. See above, CF1.9 allows unsigned types.

hot007 commented 2 weeks ago

Related to this, I found https://github.com/ioos/compliance-checker/issues/972 which indicated support for CF1-9 and 1-10 was on the horizon back in March 2023 but the current checker version (v5.1.1) still stops at CF1-8, can any of the devs give us a hint when support for the newer CF versions might be available, please? We have some files being written now to CF1-10 and even 1-11 standard and we can't check them.
Thanks!