You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lat and lon coordinate variables are written with float32 (single precision) dtype instead of float64 (double precision), which is required for CMIP-compliant output.
Evidence
Reported by Fabian Wachsmann (DKRZ) after running cmip7repack on pycmor output for tos Omon (based on PR #266):
"The coordinates lat and lon are not of 'dtype double' which is required."
The cmip7repack tool rewrote the file, confirming the output does not meet ESGF publication standards.
Why this is a requirement
CMOR3 (the reference implementation) explicitly casts geographic coordinate variables to float64 — this is baked into the library, not optional.
CF Conventions §2.2 recommends double precision for coordinate variables to avoid positional errors, especially at high resolution on unstructured grids where float32 (~7 significant digits) introduces measurable inaccuracy.
Compliance checkers (PrePARE, cf-checker) and publication tools (cmip7repack) will flag or rewrite float32 coordinates.
Since pycmor writes output via xarray/netCDF4 rather than through the CMOR C library, it must enforce this requirement explicitly.
Expected behavior
lat and lon (and their bounds lat_bnds, lon_bnds) must be written as float64.
Proposed fix
Explicitly cast coordinate variables to float64 before writing — either in the coordinate writing step in std_lib or enforced at the CMOR writer level, so it applies to all pipelines by default.
Summary
latandloncoordinate variables are written withfloat32(single precision) dtype instead offloat64(double precision), which is required for CMIP-compliant output.Evidence
Reported by Fabian Wachsmann (DKRZ) after running
cmip7repackon pycmor output fortosOmon (based on PR #266):The
cmip7repacktool rewrote the file, confirming the output does not meet ESGF publication standards.Why this is a requirement
float64— this is baked into the library, not optional.float32(~7 significant digits) introduces measurable inaccuracy.cmip7repack) will flag or rewritefloat32coordinates.Since pycmor writes output via xarray/netCDF4 rather than through the CMOR C library, it must enforce this requirement explicitly.
Expected behavior
latandlon(and their boundslat_bnds,lon_bnds) must be written asfloat64.Proposed fix
Explicitly cast coordinate variables to
float64before writing — either in the coordinate writing step instd_libor enforced at the CMOR writer level, so it applies to all pipelines by default.Related
cmip7repack