Next: ncmpi_enddef, Previous: ncmpi__open, Up: Files [Index]
The function ncmpi_redef puts an opened netCDF file into define mode, so dimensions, variables, and attributes can be added or renamed and attributes can be deleted.
This API is a collective routine: all processes must provide the same value for ncid.
This API must be called while the file is in data mode, either collective or independent.
int ncmpi_redef(int ncid);
ncid
netCDF ID, from a previous call to ncmpi_open or ncmpi_create.
ncmpi_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 ncmpi_open to open an existing netCDF file named foo.nc and calling ncmpi_redef to enter the define mode:
#include <pnetcdf.h> ... int err, ncid; ... err = ncmpi_open(MPI_COMM_WORLD, "foo.nc", NC_WRITE, MPI_INFO_NULL, &ncid); if (err != NC_NOERR) printf("Error: %s\n",ncmpi_strerror(err)); ... err = ncmpi_redef(ncid); /* enter define mode */ if (err != NC_NOERR) printf("Error: %s\n",ncmpi_strerror(err));
Next: ncmpi_enddef, Previous: ncmpi__open, Up: Files [Index]