The function nc_redef puts an open netCDF dataset into define mode, so dimensions, variables, and attributes can be added or renamed and attributes can be deleted.
int nc_redef(int ncid);
ncid
nc_redef returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
Here is an example using nc_redef to open an existing netCDF dataset named foo.nc and put it into define mode:
#include <netcdf.h> ... int status; int ncid; ... status = nc_open("foo.nc", NC_WRITE, &ncid); /* open dataset */ if (status != NC_NOERR) handle_error(status); ... status = nc_redef(ncid); /* put in define mode */ if (status != NC_NOERR) handle_error(status);