|
|
|||
|
||||
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.
For netCDF-4 files (i.e. files created with NC_NETCDF4 in the cmode, see nc_create), it is not necessary to call nc_redef unless the file was also created with NC_STRICT_NC3. For straight-up netCDF-4 files, nc_redef is called automatically, as needed.
For all netCDF-4 files, the root ncid must be used. This is the ncid returned by nc_open and nc_create, and points to the root of the hierarchy tree for netCDF-4 files.
int nc_redef(int ncid);
ncidnc_redef returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
NC_NOERRNC_EBADIDNC_EBADGRPIDNC_EINDEFINENC_EPERMHere 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);
| Contact Us Site Map Search Terms and Conditions Privacy Policy Participation Policy | ||||||
|
||||||