This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: address@hidden >From: "Plonski, Michael" <address@hidden> >Subject: Re: 20010915: netcdf and multiarray directories in Netcdf ver 2 .vs. >Ver 1 >Keywords: editing attributes Mike, You wrote: > ... Do you know of any application that easily lets you add / > delete attributes from a netCDF file. I saw this question posted in > the newsgroup and I think the advice was to just use the read > routine and write routine to make something that could add and > delete values. The NCO package, freely available from http://nco.sourceforge.net/nco.html includes the ncatted netCDF Attribute Editor, described here: http://nco.sourceforge.net/nco.html#SEC44 which can be used to delete, add, and edit netCDF attributes from the command line. Also, if the netCDF file was originally created with extra space in the header, using nc__create() rather than nc_create() for example, then attributes can be added efficiently in the reserved space. However if there's not enough space in the header, adding an attribute will result in copying the file. Deleting an attribute can be done efficiently in the C interface with an nc_del_att() call, and the deleted space is available for use in adding subsequent attributes efficiently. I don't think either Java interface supports the "delete attribute" operation, however. --Russ