[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #EGM-614629]: ncgen/ncdump



Hi Alison,

> Organization: Desert Sage Software
> Package Version: 4.3.0
> Operating System: Linux 64-bit

> Description of problem: Hello,
> How do I specify a multi-line string in CDL such that ncgen -k 3 (enhanced 
> model) generates a netcdf file that when ncdump'ed will interpret the 
> embedded newlines in string attributes as line breaks? This is necessary for 
> readability of lengthy comment attributes. I have tried this attribute: 
> comment = "line one\n line two", and ncdump prints that verbatim on one line 
> instead of interpreting the \n as a newline and breaking into two lines. 
> Thanks for any help you may provide,
> Alison

Assume following is in str.cdl:

netcdf str {
dimensions:
strlen=32;
variables:
char str(strlen);
data:
str="line1\n", "line2\n", "line3\n", "last line";
}

Then this does what you want:

$ ncgen -b -k 3 str.cdl
$ ncdump str.nc
netcdf str {
dimensions:
strlen = 32 ;
variables:
char str(strlen) ;
data:

str = "line1\n",
"line2\n",
"line3\n",
"last line" ;
}

Please let us know if this doesn't work for you ...

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: EGM-614629
Department: Support netCDF
Priority: Normal
Status: Closed