[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Max length on attributes in cdl files?
- Subject: Re: Max length on attributes in cdl files?
- Date: Tue, 20 Aug 1996 14:41:10 -0600
> To: address@hidden
> From: address@hidden (Bill Moninger)
Hi Bill,
I just got back from vacation and read your posting:
> In an effort to maximize the readability of my cdl files, I entered
> extensive multi-line comments in the :units attribute. This worked fine on
> a sun running SunOS, but not on HP-UX or SGI, which bumped up against a 200
> character limit.
>
> So my question is, what is the best way to include documention like the
> following in a cdl file?
>
> THIS FAILS ON SOME MACHINES:
> byte correctedFlag(recNum);
> correctedFlag:long_name ="Corrected data indicator";
> correctedFlag:units = "
> r = raw data,
> l = data that has undergone lat/lon correction
> (other than interpolation),
> T = data that has undergone temperature correction,
> f = longitude and wind direction flipped,
> t = obs time has been set to the report receipt time
> ";
I've been trying to reproduce the problem, but was unable to on IRIX
6.2, though I did see a problem on HP-UX 9.05 that seems to be a
limitation of "lex" for which there is a work-around.
I first created the following file, named "moninger.cdl":
-------------------- moninger.cdl ------------------------
netcdf moninger {
dimensions:
recNum = 1;
variables:
byte correctedFlag(recNum);
correctedFlag:long_name ="Corrected data indicator";
correctedFlag:units = "
r = raw data,
l = data that has undergone lat/lon correction
(other than interpolation),
T = data that has undergone temperature correction,
f = longitude and wind direction flipped,
t = obs time has been set to the report receipt time
";
}
-------------------- end of moninger.cdl ------------------------
Then I tried invoking
ncgen -b moninger.cdl
on this file, using the latest version of the netCDF software (2.4.3).
On the SGI, the netCDF file "moninger.nc" was created without error.
Using ncdump on it, I get:
-----------------------------------------------------------------
netcdf moninger {
dimensions:
recNum = 1 ;
variables:
byte correctedFlag(recNum) ;
correctedFlag:long_name = "Corrected data indicator" ;
correctedFlag:units = "\n",
" r = raw data,\n",
" l = data that has undergone lat/lon correction\n",
" (other than interpolation),\n",
" T = data that has undergone temperature correction, \n",
" f = longitude and wind direction flipped, \n",
" t = obs time has been set to the report receipt time\n",
"" ;
data:
correctedFlag = 129 ;
}
-----------------------------------------------------------------
which is another way to express multi-line text attributes, by
explicitly including the embedded new-lines ("\n").
Invoking
ncgen -b moninger.cdl
on HP-UX 9.05 yields
ncgen: moninger.cdl line 7: out of memory
which I believe is a limitation of lex documented in the HP lex man
page:
The token buffer in the program built by lex is of fixed length,
yytext[YYLMAX]
where YYLMAX is defined to be 200 unsigned characters or 400 unsigned
characters if -m has been specified and LC_CTYPE indicates a multi-
byte character set. Overflow of this array is not detected in the
lex.yy.c program.
If you instead enter the multi-line attributes using trailing embedded
"\n" characters, as in the output of ncdump above, things work fine and
ncgen is able to parse the resulting CDL file, even on HP-UX.
--Russ