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.
If the file is in netcdf-4 format, then the performance consequences should be very small -- only the cost of writing the new attributes. If the file is in netcdf-3 format, then basically what is going to happen is that the existing file data will be moved in the file to make room for the new metadata (i.e. the new attributes in this case). So the cost will be proportional to the amount of data. Also, the new metadata will need to be re-written to the file, and the cost to do that will depend on the amount of metadata. At a guess, the total cost will be about the same as reading and writing the file once. There is an exception to this. If you are not writing new attributes and the new values you give to existing attributes is no larget than the original size, then the only cost is to write the attribute. The metadata and data will not be re-written. > > On your website one can read with regard to "nc_enddef" the following: > "This call may involve copying data under some circumstances." Could you > please tell me what performance implications it may have and under which > circumstances? Or more specifically, could you please tell whether there > are any performance or otherwise possible complications with re-entering > the define mode and adding attributes after the file has been already > populated with (big) data? > > Thanks, > > Alex > > > =Dennis Heimbigner Unidata Ticket Details =================== Ticket ID: YEI-230852 Department: Support netCDF Priority: Normal Status: Open =================== 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.