[ncl-talk] Adding a new variable to an existing netcdf4 file
Pang Jiongming
pang.j.m at hotmail.com
Fri Apr 27 20:33:25 MDT 2018
Dave,
Thanks a lot. The problem is solved.
Jiongming
On Apr 28, 2018, at 06:34, Dave Allured - NOAA Affiliate <dave.allured at noaa.gov<mailto:dave.allured at noaa.gov>> wrote:
Jiongming,
Sorry, I missed something in your first message. For the following method to work, do not use filevarattdef from the NCL website example. Just write each NC_CHAR attribute directly using the single command below.
--Dave
On Fri, Apr 27, 2018 at 1:48 PM, Dave Allured - NOAA Affiliate <dave.allured at noaa.gov<mailto:dave.allured at noaa.gov>> wrote:
Jiongming,
I think you want to write an attribute as type NC_CHAR, to a netcdf4 file. Is that right? If so, then use this kind of type conversion in NCL:
f->var at attrib = tochar ("any string")
Please note that any_string must be scalar (single string, not array) for this method, because of a netcdf format constraint. That is the most common need. There are more complicated methods for arrays of strings.
--Dave
On Fri, Apr 27, 2018 at 5:07 AM, Pang Jiongming <pang.j.m at hotmail.com<mailto:pang.j.m at hotmail.com>> wrote:
Hi there,
I’m a NCL user, and being facing with a problem when I use NCL to add a new variable with attributes to an existing netcdf4 file.
My wrfoutput from WRF/Chem is netcdf4 format. I need to add a new variable with attributes. By following the example in NCL website, functions addfile, filevardef, and filevarattdef were used. After that, there is a tag ’string’ before all attributes which contains characters of the new variable. I search online, it shows that it is NC_STRING, not NC_CHAR. Could you help me to solve it? Thank you very much.
Best regards,
Jiongming
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180428/8733de0a/attachment.html>
More information about the ncl-talk
mailing list