ioos/compliance-checker

CF Checker Plugin: remove dimension type for unlimited dimensions

Closed this issue · 1 comments

current situation

The CF Conventions recommend that dimensions of a variable are given in the order T, Z, Y and X (cdl-/Fortran-like index order). Additional dimensions, which are not T, Z, Y or X, should be located left of T (see Section 2.4 Dimensions for details). The four letters mean:

  • T: time dimension
  • Z: z-axis dimension (vertical axis)
  • Y: y-axis dimension (one of two horizontal axis; if lon-lat system then y == lat)
  • X: x-axis dimension (one of two horizontal axis; if lon-lat system then x == lon)

In the section on feature types, there is a requirement for the location of the unlimited dimension. However, according to a current issue in the CF Conventions discussion repository, this requirement is a technical requirement of pre-netCDF4 times when unlimited dimension could only be located on the left.

The IOOS CC CF Plugin has two additional dimension types (L and U):

  • L: unlimited dimension
  • U: unknown / other dimension

The CF plugin tries to match each dimension to one of the types L, T, Z, Y, X and U. L und U mean. Unlimit-ness is checked first. Thus, if a dimension is unlimited, it is of type L and cannot be of type T, Z, Y, X or U.

shortcoming / issue

The IOOS CC CF Plugin checks CF Section 2.4 by this regular expression ^[^TZYX]*T?Z?Y?X?$.

In non-netCDF4 files the unlimited dimension has to be the left-most dimension. Thus, the L dimension will always be on the left. This provided check works fine in all situations.

However, this check might not work for netCDF4 files: (a) there might be more than one unlimted dimension; (b) unlimited dimension(s) might be at an arbitrary location in the order of dimensions. Thus, if we have T, Z, Y and X dimensions and the Z-dimension is unlimited, the IOOS CF plugin would yield T, L, Y, X. The regex provided above could not be matched to the string TLYX. Therefore, using dimension type L might cause issues.

suggestion

Dropping the type L and assigning only T, Z, Y, X OR U as dimension types would prevent some issues in netCDF4 files.

The type L is used by no other check. Hence, dropping it would have not side effects.

see also issue #836 where I brought this topic up as a side-note