NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Bug in ncgen handling of multidimensional character variables

Hi,

An undocumented feature of ncgen in netCDF-2 was that null padding was
added to strings that were shorter than the last dimension of a
multidimensional character variable, instead of just concatenating them.
This permitted using strings of different lengths in an array in CDL,
for example:

    netcdf bug {
    dimensions:
            scan = 4 ;
            string_len = 10 ;
    variables:
            char name(scan, string_len) ;
    data:

     name
      "Methane",
      "Ammonia",
      "Water",
      "Acetylene" ;
    }

In versions 3.3 and 3.3.1, unfortunately this feature no longer works.
Instead the strings are just concatenated, as they would be with a
1-dimensional variable.  For example, when the above CDL file is
converted to a netCDF file using the "-b" option to ncgen, running
ncdump on the result produces:

    netcdf bug {
    dimensions:
            scan = 4 ;
            string_len = 10 ;
    variables:
            char name(scan, string_len) ;
    data:

     name
      "MethaneAmm",
      "oniaWaterA",
      "cetylene",
      "" ;
    }

A patch is now available that fixes the problem, from

    http://www.unidata.ucar.edu/packages/netcdf/patch-3.3.1-2

The problem description and a link to the patch have been added to the
"Known Problems" page for netCDF at

    http://www.unidata.ucar.edu/packages/netcdf/known_problems.html

The fix will be included in the next minor release.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu

  • 1997 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: