NCL Website header
NCL Home > Documentation > Language

Adding a carriage return to a NetCDF string

There are several NetCDF attributes that have the potential for being very long. When a NetCDF file is converted to ASCII by ncdump, these long attributes will continue to wrap around in a disorganized manner. You can avoid this problem when creating a NetCDF file by putting carriage returns into any long strings.

Method 1:
    cdf_out@history = "A long string can be broken up ~C~  
    by adding a carriage return to it using a capital C ~C~
    surrounded by a function code."
    
Method 2:
    cr = tochar(10)

    cdf_out@title = "A file demo of" + cr + \ 
    "using a carriage return to" + cr + \ 
    "make neat text" +cr

    The "\" is used to continue the text to the next line. It is 
    invisible in the string.