CF 1.7 compliance of netCDF data from CDS-beta

Hi!
I have migrated to the new CDS-beta by cdsapi serving data cfgrib converted into netCDF format, and my Fortran program chokes reading the data. Sigh. The problem is that type “string” for character attributes is NOT supported by the netCDF Fortran library. And, worse, it is not CF-1.7 compliant, which is the version document the Conventions global attribute in the file (unreadable from Fortran :slight_smile: ) claims the data format to comply to. Because A LOT of Fortran code still out here reading netCDF formatted data for science, maybe some mitigation action should be put in place.

https://github.com/Unidata/netcdf-fortran/issues/181

Regardless, the Conventions attribute used in the file should be at least updated to the value “CF-1.8” to start using netCDF4 string type for the data attributes.

Just to follow-on on the type chosen for the attributes, some viewers (GrADS, ncview) don’t know what to do with type NC_INT64. If it is not strictly required by the data, why use 64 bit type for storing constants like 0? Why not use NC_INT?

My bad, actually the first CF convention documents allowing strings for text attributes is the CF-1.9.

https://cfconventions.org/Data/cf-documents/requirements-recommendations/conformance-1.9.html

In CF-1.8 and below, you can still read:

2.2 Data Types

Requirements:

  • CF attributes that take string values must be 1D character arrays.