NetCDF Documentation

NetCDF 4.1.1 is installed in /opt/netcdf and compiled with gnu, intel, and pgi:

  • /opt/netcdf/gnu
  • /opt/netcdf/intel
  • /opt/netcdf/pgi

** Please Note for Fortran Builds ** 

Starting with version 4.1.1, another method of building the netCDF fortran libraries specifies that the C library should not contain the fortran functions anymore.  Building separate fortran libraries is required for shared library builds.  In previous releases, the C and Fortran functions were in the same static library.  In the new release, an additional library, libnetcdff.a (not the extra “f”)  contains the fortran functions. 

Linking 

To link against a fortran program with the separate fortran library (gnu build), you must link to both the fortran and the C libraries:

gfortran -o myprogram myprogram.o -L/opt/netcdf/gnu/lib -lnetcdff -lnetcdf

To link against the c library (intel build):

icc -o myprogram myprogram.o -L/opt/netcdf/intel/lib -lnetcdf

To link against the c++ library (gnu build):

g++ -o myprogram myprogram.o -L/opt/netcdf/gnu/lib -lnetcdf_c++

Execution

To run your program that used the netcdf libraries, you must set your library path:

Bash Shell
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/netcdf/{compiler}/lib
Tcsh Shell
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/opt/netcdf/{compiler}/lib

Compiled Options

  • Large file support enabled (> 2GB files).
  • Shared & static libraries built.

Directory Structure

lib
Libraries installed here.
  • C API:  libnetcdf.a and libnetcdf.la
  • C++ API:  libnetcdf_c++.a and libnetcdf_c++.la
  • Fortran API:  libnetcdff.a and libnetcdff.la

Static library users should ignore the .la files, and link to the .a files.

Shared library builds add some .so files to this directory, as well.

include
Header files installed here.
  • C API:  netcdf.h
  • C++ API:  ntcdfcpp.h, ncvalues.h and netcdf.hh
  • F77 API:  netcdf.inc
  • F90 API:  netcdf.mod and typesizes.mod
bin
Utilities ncdump and ncgen
 
share/man
The ncdump/ncgen man pages installed in subdirectory man1, and the three man pages netcdf.3, netcdf_f77.3, and netcdf_f90.3 installed in the man3 subdirectory.

To access the full documentation, tutorial, users guides, and FAQs, please follow the link to unidata at ucar: www.unidata.ucar.edu/software/netcdf/docs/