Re: Problems with Strings

On Sun, 14 Jul 1996 19:14:32 EDT, Tim Weilkiens wrote:

>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 had this problem with ncgen myself.  I solved it by adding lex code into 
ncgen to 
recognize strings and I thought that I remember Russ Rew mentioning that, after 
careful consideration, the netCDF group had decided to implement the string fix 
for 
NC_CHAR variables.  

My fix was to have ncgen fill out the rest of the string array with NULLs 
whenever a 
end-quote was hit.  The reason I found this necessary was that otherwise the 
files 
created with ncdump could not be recompiled with ncgen.

I would be happy to discuss the particular code if this is not part of the 
general netCDF 
distribution, but (if this fix is not part of netCDF) you would have to be 
aware that you 
will be producing files that will be non-standard because you aren't padding 
the strings 
out with spaces (FORTRAN style), which is (was?) the defacto standard for 
netCDF 
strings...

Let me know if Im wrong about this,

blincoln
blincoln@xxxxxxxxxx

SSESCO West Coast
(415) 529-1136
B Lincoln
PO Box 620855
Woodside, CA 94062


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