2012 Unidata NetCDF Workshop > Introduction to the NetCDF APIs
10.3 The Fortran-90 API
The Fortran-90 library provides Fortran 90/95 support for modelers and scientists.
Strengths
- Well documented:Complete and up-to-date Fortran-90 Users Guide
- Overloaded functions and optional arguments:
simpler API. For example, one
nf90_put_var() function
replaces thirty nf_put_var() functions in the Fortran-77 interface and
forty nc_put_var() functions in the C interface.
- Fewer function arguments: string lengths need not be passed
for attribute strings, and array lengths need not be passed for
dimension arrays.
- Improved error checking: use of
INTENT
declarations lets
compilers check whether some arguments are used correctly.
- Array sections supported:
simplifies programming
Weaknesses
- Support for netCDF-4 user-defined compound types not portable, requires Fortran-2003
- Column-major subscript order (1st dimension varies fastest) reversed from CDL row-major order
- No ncgen support: ncgen cannot generate Fortran-90 code (yet),
though Fortran-77 code ncgen3 generates works from Fortran-90
- You have to explicitly provide memory
space for any netCDF data values and attribute values you read.
- Status of every function call must be explicitly checked
Other Characteristics
- Library implemented in Fortran-90 as a thin layer on top of
the Fortran-77 library, which in turn is a thin layer on top of the C
library
- C, C++, and Fortran netCDF libraries are separate software
distributions since netCDF-C version 4.2
2012 Unidata NetCDF Workshop > Introduction to the NetCDF APIs