Next: , Previous: nc__open, Up: Datasets


2.8 Put Open NetCDF Dataset into Define Mode: nc_redef

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.

Usage

     int nc_redef(int ncid);
ncid
netCDF ID, from a previous call to nc_open or nc_create.

Errors

nc_redef returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

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);