Re: deleting dimensions and variables

Hi James,

> Is there no way to delete a dimension, a variable or a data element from
> a netCDF database?

There are no netCDF functions for deleting variables, dimensions (which
may be shared by multiple variables), or data.  Deleting dimensions,
variables, or data can only be accomplished by copying everything except
what you want deleted to a new dataset.

Permitting deletion of dimensions or variables, which are specified in
the C and Fortran interfaces by small integer handles in a consecutive
range of integers, would complicate the interfaces.  For example, after
deletion of a variable either subsequent variable IDs would have to
change (to preserve the ability to iterate through all the variables
using consecutive IDs) or the interfaces would have to be changed to
handle "holes" in the range of variable IDs.

Deletion of dimensions or variables also brings up garbage collection
issues.  It would only make sense to delete a dimension after all the
variables that use that dimension had been deleted.  If a variable was
deleted, making the space allocated for that variable's data available
might require work equivalent to copying the whole file anyway.

These issues don't arise for attributes, which are accessed by name
rather than by integer handles, and for which space is not considered
significant enough to warrant recovery.  Thus deletion of attributes is
supported (though apparently rarely used).

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu


  • 1998 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: