2009 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF APIs
10.4 The Fortran-77 API
The Fortran-77 library provided early Fortran support for modelers and scientists.
Strengths
- Well-documented: The netCDF Fortran-77 Users Guide is complete and
up-to-date, and reference documentation is maintained in man-page
form.
- Comprehensively tested: A large number of tests are run when
the netCDF Fortran-77 library is installed from source.
- Support by ncgen utility: The ncgen utility, given a CDL file, can
generate the Fortran-77 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. (However, the generated
ncgen code is awkward for record variables of type character.)
- Support for netCDF-4: the F77 API supports the extended data
model of netCDF-4 (but using some advanced features may make your
code unportable.)
Weaknesses
- Uses character arrays as a substitute for strings, so user must
be aware of string lengths.
- Fortran's column-major subscript order is different from CDL's
row-major order, whcih can make ncdump's CDL output confusing.
- Memory handling: 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.
Other Characteristics
- Implemented as a thin layer on top of the C
netCDF library.
Examples
Annotated examples of complete Fortran77 netCDF programs are available from
the program examples page.
2009 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF APIs