Skip to content

Netcdf load should workaround unexpected names in 'coordinates' #3644

@pp-mo

Description

@pp-mo

We encountered a file where loading fails due to a variable referencing as 'coordinates' a dimension that it doesn't actually use.

Simplified example CDL :

netcdf minimal_failcase {
dimensions:
                length_scale = 1 ;
                lat = 3 ;
variables:
                float lat(lat) ;
                                lat:standard_name = "latitude" ;
                                lat:units = "degrees_north" ;
                short lst_unc_sys(length_scale) ;
                                lst_unc_sys:long_name = "uncertainty from large-scale systematic errors" ;
                                lst_unc_sys:units = "kelvin" ;
                                lst_unc_sys:coordinates = "lat" ;

data:
  lat = 0, 1, 2;
}

LOADING FAILS
with message"ValueError: Missing data dimensions for multi-valued DimCoord 'latitude'"

Proposal
Strictly, this is not good CF.
Cf-checker confirms this, saying "INFO: attribute coordinates is being used in a non-standard way".
However, we should probable be capable of gracefully working around this type of problem,
as we do for invalid 'unit' and 'standard_name'.

Metadata

Metadata

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions