Hi Phil, > Thanks for replying to my recent comment against CF ticket 76 regarding > encoding of multiple string values within the global history attribute. > I'd forgotten that netcdf-3 only supports char vectors, and not string > vectors. > > Part of the reason for me overlooking that fact was the following > partial ncdump header listing of a classic netcdf file which has been > updated multiple times by the ncatted tool. On the face of it, this > appears to show a history attribute consisting of multiple strings (6 to > be exact). I just happened to use this file as a reference point when I > was formulating my CF comment! > > $ ncdump -h tasmean-1960-90-ll.nc > ... > // global attributes: > :history = "Fri Aug 1 13:41:42 2008: ncatted -a > long_name,air_temperature1,m,c,Temperature at 1.5 m > tasmean-1960-90-ll.nc\n", > "Fri Aug 1 13:39:52 2008: ncatted -a > long_name,air_temperature1,c,c,Temperature at 1.5 m > tasmean-1960-90-ll.nc\n", > "Tue Apr 1 10:56:27 2008: ncatted -a axis,air_temperature1,d,c, > boundsupdate.nc\n", > "Tue Apr 1 10:56:12 2008: ncatted -a > standard_name,air_temperature1,m,c,air_temperature boundsupdate.nc\n", > "Tue Apr 1 10:54:26 2008: ncatted -a > standard_name,air_temperature1,m,c,temperature boundsupdate.nc\n", > "Tue Apr 1 10:54:00 2008: ncatted -a axis,air_temperature1,m,c,TZYX > boundsupdate.nc" ; > > $ ncdump -k tasmean-1960-90-ll.nc > classic > > And if I display the global attributes using ncks I get the following: > > $ ncks -M tasmean-1960-90-ll.nc > Opened file tasmean-1960-90-ll.nc: dimensions = 5, variables = 9, global > atts. = 2, ID = 65536, type = NC_FORMAT_CLASSIC > Record dimension: name = time, size = 1 > Global attribute 0: Conventions, size = 7 NC_CHAR, value = CF-1.0 > Global attribute 1: history, size = 590 NC_CHAR, value = Fri Aug 1 > 13:41:42 2008: ncatted -a long_name,air_temperature1,m,c,Temperature at > 1.5 m tasmean-1960-90-ll.nc > Fri Aug 1 13:39:52 2008: ncatted -a > long_name,air_temperature1,c,c,Temperature at 1.5 m > tasmean-1960-90-ll.nc > Tue Apr 1 10:56:27 2008: ncatted -a axis,air_temperature1,d,c, > boundsupdate.nc > Tue Apr 1 10:56:12 2008: ncatted -a > standard_name,air_temperature1,m,c,air_temperature boundsupdate.nc > Tue Apr 1 10:54:26 2008: ncatted -a > standard_name,air_temperature1,m,c,temperature boundsupdate.nc > Tue Apr 1 10:54:00 2008: ncatted -a axis,air_temperature1,m,c,TZYX > boundsupdate.nc > > which looks as expected, i.e. a text string with newline chars honoured. > > So is the first example simply a manifestation of the way in which > ncdump (we're using v4.1.2) is programmed to display char attributes > containing embedded \n characters, perhaps? Yes, exactly! I see the ncdump man-page documentation doesn't mention the handling of "\n" characters when displaying character-variable values, so there was no way you could have known this without reading the ncdump source code, and this behavior goes away for netCDF-4 files that have real strings: case '\n': /* Only generate linebreaks after embedded newlines for * classic, 64-bit offset, or classic model files. For * netCDF-4 files, don't generate linebreaks, because that * would create an extra string in a list of strings. */ I'll put adding information about this little idiosyncracy in ncdump documentation on my list of things to do. Thanks for pointing out the problem! --Russ > PS: Hope the netcdf workshop at ESRI this week is useful. I shall look > forward to reading about any decisions/outcomes for enhanced ArcGIS 10.x > capabilities. It was a very interesting meeting for me, and I hope for ESRI, too. If I ever get around to using the Unidata Developers Blog to write some summary notes, I'll let you know ... Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: TWD-935825 Department: Support netCDF Priority: Normal Status: Closed
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.