2007 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF APIs
5.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 is currently a significant advantage, 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.)
Other Characteristics
- Implemented as a thin layer on top of the C
netCDF-3 library.
- Order of subscripts in CDL: CDL uses row-major order for
matrices (last dimension varies fastest), but Fortran uses
column-major order (first dimension varies fastest), which can
be 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.
Examples
Annotated examples of complete Fortran77 netCDF programs are available from
the program examples page.
2007 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF APIs