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.

Problems with Strings

Hi,

I have sent the following message a few days ago to this list:

-------------------------------------------------------

My netCDF file structure:

..
dim2 = 2;
dim30 = 30;
..
char name(dim2, dim30);
..

I read the data with:

long start[MAX_DIMS] = {0, 0};
long count[MAX_DIMS] = {2, 30};
ncvarget(cdfid, start, count, &value);

After this operation value contains the data in this way: 
<string1><string2>, e.g. JohnPaul

So, how can I know which part is the first string and which is the second.
There is no delimiter set, and I only know that the max. string length is 30.

-------------------------------------------------------

The problem seems to be a bug in ncgen. I have created the netCDF file
with ncgen from a CDL file. The CDL file contains the line
name = "string1", "string2";

Looking at the netCDF file with ncdump:

name = "string1string2", "";

I didn't realized this, so I thought it was an error in my program.


Tim





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