next up previous contents
Next: NetCDF file operations Up: NetCDF routines Previous: NetCDF routines   Contents

Error handling

If an error occurs, the default behaviour is to print an error message and exit. It is possible to change this behaviour by modifying the value of the global variable ncopts. The default setting is

   ncopts = NC_VERBOSE | NC_FATAL;
which means print error messages and exit when an error occurs. To get error messages without having fatal errors, set
   ncopts = NC_VERBOSE;
For neither error messages nor fatal errors, set
   ncopts = 0;

In these last two cases, the calling routine should check the function value returned by each call to a NetCDF function. All routines return an integer value. If the value is $-1$ (MI_ERROR), then an error has occurred. The value of the global variable ncerr gives more information on the type of error (see file netcdf.h for error codes).

Robert VINCENT 2004-05-28