Next: , Previous: , Up: Files   [Index]


2.9 Put Open NetCDF File into Define Mode: ncmpi_redef

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.

Operational Mode

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.

Usage

int ncmpi_redef(int ncid);
ncid

netCDF ID, from a previous call to ncmpi_open or ncmpi_create.

Return Error Codes

ncmpi_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 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: , Previous: , Up: Files   [Index]