NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
The \n is the method for embedding a new line in 'C'. To do it in FORTRAN, you will need to do something like: status = nf_put_att_text(ncid,nf_global,'experimental3',16,"LineOne" // char(10) // "LineTwo.") Ian Harris wrote:
Hi, Firstly, apologies if this list isn't the closest match to my problem - I can't see one closer! I'm writing NetCDF files from F77, all working nicely.. until I try to write text attributes with multiple lines. As far as I can discover, I'm supposed to embed '\n' terminators in the strings, which makes sense to me. UCAR's NetCDF information includes: <QUOTE> The usual escape conventions for C strings are honored. For example: "a" // ASCII 'a' "Two\nlines\n" // a 10-character string with two embedded newlines "a bell:\007" // a string containing an ASCII bell "ab","cde" // the same as "abcde" </QUOTE> (From http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html - I'm currently running NetCDF 3.6.3 according to ncdump) However, when I try this, it doesn't seem to work. The library seems to add a second backslash. For example: I run: status = nf_put_att_text(ncid,nf_global,'experimental3',16,"LineOne\nLineTwo.") ncdump -h on the result: :experimental3 = "LineOne\\nLineTwo" ; I note that the full stop is missing from the end, implying to me that the '\n' has been counted as a single character, but the extra '\' has exhausted the character count (16) before the end. Is this expected behaviour? If so, is there any way for me to produce multi-line attribute values? Cheers Harry Ian "Harry" Harris Climatic Research Unit School of Environmental Sciences University of East Anglia Norwich NR4 7TJ United Kingdom IMPORTANT NOTICE - This email is intended for the named recipient only. It may contain privileged and confidential information. If you are not the intended recipient, notify the sender immediately and destroy this email. You must not copy, distribute or take action in reliance upon it. Whilst all efforts are made to safeguard emails, The School of Environmental Sciences cannot guarantee that attachments are virus free or compatible with your systems and does not accept liability in respect of viruses or computer problems experienced. _______________________________________________ netcdfgroup mailing list netcdfgroup@xxxxxxxxxxxxxxxxFor list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
-- Larry Oolman Department of Atmospheric Science University of Wyoming Dept. 3038, 1000 E. University Ave. Laramie, WY 82071 ldoolman@xxxxxxxx http://www-das.uwyo.edu
netcdfgroup
archives: