Difference between revisions of "NetCDF"

From HPC users
Jump to navigationJump to search
Line 12: Line 12:
  -I$NETCDF_INCDIR
  -I$NETCDF_INCDIR


or in a Makefile
or in a ''Makefile''


  -I$(NETCDF_INCDIR)
  -I$(NETCDF_INCDIR)
Line 28: Line 28:
   -L$NETCDF_LIBDIR -lnetcdff -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz
   -L$NETCDF_LIBDIR -lnetcdff -lnetcdf -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz


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

Revision as of 16:24, 6 February 2015

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 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 directory 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).