[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 {
char str(strlen);
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 {
strlen = 32 ;
char str(strlen) ;

str = "line1\n",
"last line" ;

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


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

NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.