NetCDF 4

1.  Installing NetCDF + HDF5 with a packet manager


2.  Compiling and installing NetCDF + HDF5 manually


If you are planning to use a non standard compiler (e.g.: Intel, PGI...) to compile your software or the version of the libraries provided with your distribution is not the one you need, you should follow the instructions below in order to manually compile and install NetCDF 4 with HDF5 support. In order to do so you should obtain the source files from http://www.hdfgroup.org/HDF5/ and http://www.unidata.ucar.edu/software/netcdf/.

2.1  Compile and install HDF5

Once you have downloaded the package you should decompress it and untar it in a directory of your choice, for example :

$ tar -zxvf hdf5-1.8.5-patch1.tar.gz -C /home/myuid

or

$ tar -jxvf hdf5-1.8.5-patch1.tar.bz2 -C /home/myuid

You should then enter the directory where the content was decompressed

$ cd hdf5-1.8.5-patch1

and launch the autoconf script with the following options:

$ ./configure --prefix=/home/myuid/hdf5

where /home/myuid/hdf5 is the directory where you want HDF5 installed. Take note of this path because you will need it when compiling your software!

If you want to compile the library with another compiler (e.g.: Intel) then compile it this way:

$ CC=icc ./configure --prefix=/home/myuid/hdf5

where CC holds the name of the C compiler. After that just type the usual

$ make
$ make install

2.2  Compile the actual NetCDF library

Download the package from the site indicated above and proceed to unpack it

$ tar -zxvf netcdf-4.1.1.tar.gz -C /home/myuid

and launch the configure with the following options

$ ./configure --prefix=/home/myuid/netcdf --disable-dap --enable-netcdf4 --with-hdf5=/home/myuid/hdf5/

to compile the standard NetCDF library. Our suggestion above is to compile it with the standard libz for compression and no OpenDAP support. If you want to use OpenDAP or szlib for compression please refer to the NetCDF website.

To compile with non-GNU compilers type something like

$CC=icc CXX=icpc F77=ifort FC=ifort ./configure --prefix=/home/myuid/netcdf --disable-dap --enable-netcdf4 --with-hdf5=/home/myuid/hdf5/

Finally to compile type

$ make
$ make install