⇐ ⇒

[CF-metadata] CF Conventions and NetCDF4 string attributes

From: stephen.pascoe at stfc.ac.uk <stephen.pascoe>
Date: Fri, 24 Jan 2014 09:06:01 +0000

Hi Charlie,

> However this issue is resolved, there is a workaround available now:
> ncdismember (and ncks -3) automatically translates netCDF4 files to
> netCDF3 files, and optionally sends them to a cfchecker. It translates scalar NC_STRING attributes to NC_CHAR arrays.

I've tried this and it doesn't seem to work with ncks version 4.3.4. I get the same error as I would if I used "nccopy -k 1":

$ ncks -3 my_string_file.nc my_nc3_file.nc
nco_err_exit(): ERROR Short NCO-generated message (usually name of function that triggered error): nco_copy_att()
nco_err_exit(): ERROR Error code is -45. Translation into English with nc_strerror(-45) is "NetCDF: Not a valid data type or _FillValue type mismatch"
nco_err_exit(): ERROR NCO will now exit with system call exit(EXIT_FAILURE)

where nc_string_file.nc is:

$ ncdump my_string_file.nc
netcdf my_string_file {

// global attributes:
                string :my_string_attribute = "this is a single-valued NC_STRING variable" ;
}

I guess in theory the attribute is a length-1 array of strings which cannot be mapped to an NC_CHAR array without some approximations.

S.

---
Stephen Pascoe  +44 (0)1235 445980
Centre of Environmental Data Archival
STFC Rutherford Appleton Laboratory, Harwell Oxford, Didcot OX11 0QX, UK
-----Original Message-----
From: Charlie Zender [mailto:zender at uci.edu] 
Sent: 23 January 2014 17:36
To: CF Metadata Mail List
Subject: Re: [CF-metadata] CF Conventions and NetCDF4 string attributes
Hi Stephen,
The example you posted illustrates one of many netCDF4 features that are creeping into datasets. One of your suggestions is to explicitly loosen the rules and to allow CF to accept scalar NC_STRINGs.
There are trade-offs to such exceptions.
This might put CF on a slippery slope to greater netCDF4 acceptance (good, IMHO) yet immediately puts a whole class of CF applications in jeopardy of not working with files that are nominally CF-compliant because they have an NC_STRING the application does not understand (awkward, until application is "fixed").
However this issue is resolved, there is a workaround available now:
ncdismember (and ncks -3) automatically translates netCDF4 files to
netCDF3 files, and optionally sends them to a cfchecker. It translates scalar NC_STRING attributes to NC_CHAR arrays.
http://nco.sf.net/nco.html#ncdismember
http://nco.sf.net/nco.html#ncks
Best,
Charlie
--
Charlie Zender, Earth System Sci. & Computer Sci.
University of California, Irvine 949-891-2429 )'( _______________________________________________
CF-metadata mailing list
CF-metadata at cgd.ucar.edu
http://mailman.cgd.ucar.edu/mailman/listinfo/cf-metadata
-- 
Scanned by iCritical.
Received on Fri Jan 24 2014 - 02:06:01 GMT

This archive was generated by hypermail 2.3.0 : Tue Sep 13 2022 - 23:02:41 BST

⇐ ⇒