NetCDF

From HPC users
Revision as of 17:36, 6 February 2015 by Albensoeder (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The NetCDF package is a software and library to write machine independently large data sets. Different versions compiled with different compilers are available. A list is given by typing

module avail netcdf

Within the modules the interfaces, header files and libraries for Fortran, C and C++ are available. The libraries are compiled with NetCDF 4 and HDF5 support, but without parallel support.

The intel and gcc versions are compiled with the Intel or the GNU compilers. This distiction is needed for Fortran because the .mod files are incompatible between gfortran' and ifort.


Compilation and Linking

When loading the module for convinience the environment variables NETCDF_DIR, NETCDF_INCDIR and NETCDF_LIBDIR are set to the main, include and library path of NetCDF, respectively. The extension of the search path for header/module files is simply done by the compiler option

-I$NETCDF_INCDIR

or in a Makefile

-I$(NETCDF_INCDIR)

The libraries can be linked by the compiler options

 -L$NETCDF_LIBDIR -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

When using the C++ or Fortran interface please use

 -L$NETCDF_LIBDIR -lnetcdf_c++4 -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

or

 -L$NETCDF_LIBDIR -lnetcdff -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

repectively. If you use a Makefile don't forget the round bracket around the environment variable names (see above).


External links