9.1 The C API
The C library is the core implementation on which non-Java
interfaces are built.
The netCDF-3 C interface provides portability, performance, and reliability.
- Well-documented: The netCDF C Users Guide is complete and
up-to-date, and reference documentation is maintained in man-page
- Comprehensively tested: A large number of tests are run when
the netCDF C library is installed from source.
- Good support: Since the Unidata developers use the C interface
and provide support for it, answers for many support questions are
- Many users: The C interface is one of the most widely used
- Supported by ncgen utility: The ncgen utility, given a CDL file, can
generate the C code needed to
create the file. This helps if you want to avoid writing the
boilerplate code to create files with lots of variables and attributes.
- Uses character arrays as a substitute for strings, so user must
be aware of string lengths.
- Memory handling and garbage collection: You have to provide memory
space for any netCDF data values and attribute values you read.
- Error handling: The status of every function call must be
checked, which detracts from code clarity.
- Advanced features of the netCDF Java interface are lacking.
Annotated examples of complete C netCDF programs are available from
the program examples page.