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.
>From: "Jessica Thomale" <address@hidden> >Subject: Support for variable removal? >Organization: OU >Keywords: 199906211607.KAA15609 netCDF Hi Jessica, > I was wondering if there were any plans for variable removal? > > There are methods for removing attributes and other elements of the netcdf > files, but no removal of variables. > > The reason I bring up this topic is that when I need to remove a variable. > I have to either rename it which means it is still taking up space in the > netcdf file or I have to remake the file without that variable. Neither > solution is very efficient. > > Is there a work around? No, sorry, there are no plans to implement variable removal in netCDF. To implement variable removal so that the variable would not still take up space in the file would essentially require copying the file, unless the variable just happened to be the last variable in a file with no unlimited dimension. Some efficiency could be gained for deleting multiple variables by only copying the remaining variables once, but users can do this also with the current interface. There is also the question of whether to delete dimensions only used by a variable to be deleted. Finally, there have not been many requests for this capability, compared to other desired enhancements. There are utilities that make deleting variables easier, by doing the work of copying all but specified variables from an input netCDF file to an output netCDF file. For example, see ncks, part of the NCO package: ncks will extract (and optionally create a new netCDF file comprised of) only selected variable from the input file, like ncextr(1) but with these differences: Only variables and coordinates may be specifically included or excluded--all global attributes and any attribute associated with an extracted variable will be copied to the screen and/or output netCDF file. Options `-c', `-C', `-v', and `-x' control which variables are extracted. The NCO package is freely-available from http://goldhill.cgd.ucar.edu/cms/nco/ > Also, when is version 4 for C/C++ due to come out? I am really looking > forward to some of the new features that were announced. The plans for netCDF 4 are on hold while we evaluate how we will make use of HDF-5, whether to write a new C++ layer for both the current XDR format and a new HDF-5 representation. Our plans had been to use what we learned in developing the Java interface to write the new C++ implementation, but the loss of the main developer, Glenn Davis, has forced a change in plans. We will have to reevaluate how we will continue netCDF development after we have hired a replacement. Sorry I can't be more definite, but things are still up in the air ... --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu