Skip to content

external_variables not suppressing CF-Checker errors #116

@apcraig

Description

@apcraig

I am getting errors associated with variables that have coordinates defined but where those coordinates are also external variables. I am using https://cfchecker.ncas.ac.uk. Any ideas? The file has

>ncdump -h $WORKDIR/CICE_RUNS/derecho_intel_smoke_gx3_8x2_debug_diag1_histall_run2day.go15/history/iceh.2005-01-02-21600.nc 
netcdf iceh.2005-01-02-21600 {
dimensions:
	nbnd = 2 ;
	ni = 100 ;
	nj = 116 ;
	nc = 5 ;
	nkice = 7 ;
	nksnow = 1 ;
	nkbio = 3 ;
	nkaer = 5 ;
	time = UNLIMITED ; // (1 currently)
	nvertices = 4 ;
	nf = 1 ;
variables:
	double time(time) ;
		time:long_name = "time" ;
		time:units = "days since 2005-01-01 00:00:00" ;
		time:axis = "T" ;
		time:calendar = "Gregorian" ;
		time:bounds = "time_bounds" ;
	double time_bounds(time, nbnd) ;
		time_bounds:long_name = "time interval endpoints" ;
	float hi_1(time, nj, ni) ;
		hi_1:units = "m" ;
		hi_1:long_name = "grid cell mean ice thickness" ;
		hi_1:coordinates = "TLON TLAT time" ;
		hi_1:cell_measures = "area: tarea" ;
		hi_1:comment = "ice volume per unit grid cell area" ;
		hi_1:missing_value = 1.e+30f ;
		hi_1:_FillValue = 1.e+30f ;
		hi_1:cell_methods = "time: mean" ;
		hi_1:time_rep = "averaged" ;
	float hs_1(time, nj, ni) ;
		hs_1:units = "m" ;
		hs_1:long_name = "grid cell mean snow thickness" ;
		hs_1:coordinates = "TLON TLAT time" ;
		hs_1:cell_measures = "area: tarea" ;
		hs_1:comment = "snow volume per unit grid cell area" ;
		hs_1:missing_value = 1.e+30f ;
		hs_1:_FillValue = 1.e+30f ;
		hs_1:cell_methods = "time: mean" ;
		hs_1:time_rep = "averaged" ;
	float aice_1(time, nj, ni) ;
		aice_1:units = "1" ;
		aice_1:long_name = "ice area  (aggregate)" ;
		aice_1:coordinates = "TLON TLAT time" ;
		aice_1:cell_measures = "area: tarea" ;
		aice_1:missing_value = 1.e+30f ;
		aice_1:_FillValue = 1.e+30f ;
		aice_1:cell_methods = "time: mean" ;
		aice_1:time_rep = "averaged" ;

// global attributes:
		:title = "sea ice model output for CICE" ;
		:contents = "Diagnostic and Prognostic Variables" ;
		:source = "CICE Sea Ice Model, CICE_6.6.0" ;
		:comment = "This year has 365 days" ;
		:comment2 = "File written on model date 20050102" ;
		:comment3 = "seconds elapsed into model date:  21600" ;
		:time_period_freq = "step_6" ;
		:time_axis_position = "end" ;
		:Conventions = "CF-1.8" ;
		:external_variables = " TLON TLAT ULON ULAT NLON NLAT ELON ELAT NCAT VGRDi VGRDs VGRDb VGRDa NFSD tmask umask nmask emask blkmask tarea uarea narea earea dxt dyt dxu dyu dxn dyn dxe dye HTN HTE ANGLE ANGLET" ;
		:history = "This dataset was created on 2025-03-04 at 23:02:24.9" ;
		:date_created = "2025-03-04 23:02:24.9" ;
		:io_flavor = "io_netcdf" ;
}

And CF-Checker is generating errors that coordinate attributes TLON and TLAT do not exist even though they are clearly listed in the external_variables global attribute. See also https://cfconventions.org/cf-conventions/cf-conventions.html#external-variables

Uploaded File: iceh.2005-01-02-21600.nc

CHECKING NetCDF FILE: /tmp/tmpeh004yx5.nc
=====================
Using CF Checker Version 4.1.0
Checking against CF Version CF-1.8
Using Standard Name Table Version 89 (2025-01-21T13:26:50Z)
Using Area Type Table Version 12 (21 January 2025)
Using Standardized Region Name Table Version 5 (12 November 2024)

ERROR: (5): coordinates attribute referencing non-existent variable
ERROR: (5): coordinates attribute referencing non-existent variable
ERROR: (5): coordinates attribute referencing non-existent variable
ERROR: (5): coordinates attribute referencing non-existent variable
ERROR: (5): coordinates attribute referencing non-existent variable
ERROR: (5): coordinates attribute referencing non-existent variable

------------------
Checking variable: time
------------------

------------------
Checking variable: time_bounds
------------------

------------------
Checking variable: hi_1
------------------

------------------
Checking variable: hs_1
------------------

------------------
Checking variable: aice_1
------------------

ERRORS detected: 6
WARNINGS given: 0
INFORMATION messages: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions