How to compile and install netCDF4 with HDF5
The netCDF-4 data model, implemented using an HDF5-based storage layer for large files support, deals with all limitations of "classic netCDF model", used for netCDF-3 and earlier versions.
Requirements:
- You must have at least the HDF5 1.8.6 release or later to use the HDF5 storage format.
- You must also have the zlib compression library, version 1.2.5 or later.
- Finally the netCDF4 package
Where to find these packages:
HDF5 and zlib packages are available from the netCDF-4 ftp site at ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.
Stable releases of netCDF4 is available at http://www.unidata.ucar.edu/downloads/netcdf/index.jsp
Space requirement:
This installation requires 13Gb free to create a large nc file at the end of installation netcdf4 src directory is 6Gb
How to Install netCDF4 on Mac OS:
Open a terminal, then write the following commands to install zlib, HDF5 and netCDF4 respectively (change 'matteo' with your home account):
NOTE:If “make check” fails for either zlib or HDF5, the problem must be resolved before the netCDF-4 installation can continue.
Install zlib (e.g. version 1.2.5): download and uncompress the library, go inside the directory and edit:
cd /Users/matteo/netcdf_intall/zlib-1.2.5 ./configure --prefix=/Users/matteo/local sudo make check install
Install HDF5 (e.g. version 1.8.7): download the library, uncompress the file, go inside the directory.
21.4 Building NetCDF-4 with Parallel I/O If you want to build netCDF-4 properly to take advantage of parallel features, HDF5 must be built with --enable-parallel. The netCDF configure script will detect the parallel capability of HDF5 and build the netCDF-4 parallel I/O features automatically. No configure options to the netcdf configure are required. Edit:
cd /Users/matteo/netcdf_intall/hdf5-1.8.7 ./configure --with-zilb=/Users/matteo/local --prefix=/Users/matteo/local --disable-shared sudo make check install
After HDF5 and zlib installation is done,its time to build netCDF:
Install Netcdf (e.g. version 4.1.3). Download the library, uncompress the file, go inside the directory and edit:
cd /Users/matteo/netcdf_intall/netcdf-4.1.3 CPPFLAGS=-I/Users/matteo/local/include LDFLAGS=-L/Users/matteo/local/lib ./configure --prefix=/Users/matteo/local sudo make check install
Finally, you should make sure that the netCDF commands work properly. E.g. edit:
ncdump
If that says: command not found, it means that the binary is not in your path. To add it, change the .profile file in your home:
open .profile
and then add the line:
export PATH=/Users/matteo/local/bin:$PATH
How to Install netCDF4 on Linux Ubunto:
Open a terminal, then write the following commands to install zlib, HDF5 and netCDF4 respectively (change 'noori' with your home account):
NOTE:If “make check” fails for either zlib or HDF5, the problem must be resolved before the netCDF-4 installation can continue.
Install zlib (e.g. version 1.2.5)
Uncompress the file, go inside the directory (e.g., Downloads/zlib-1.2.5) and then run the following commands: $ ./configure --prefix=/home/noori/zlib125 $ sudo make check install
Install HDF5 (e.g. version 1.8.7)
Uncompress the file, go inside the directory (e.g., Downloads/hdf5-1.8.7) and then run the following commands: $ ./configure --with-zlib=/home/noori/zlib125 --prefix=/home/noori/hdf5187 --disable-shared $ sudo make check install
After HDF5 and zlib installation is done,its time to build netCDF:
Install Netcdf (e.g. version 4.1.3)
Uncompress the file, go inside the directory (e.g., Downloads/netcdf-4.1.3) and then run the following commands: $ ./configure --enable-netcdf-4 --enable-large-file-tests --enable-ncgen4 --with-hdf5=/home/noori/hdf5187 --with-zlib=/home/noori/zlib125 --prefix=/home/noori/netcdf4 $ sudo make check install
How to compile and install udunits library
The Udunits library UDUNITS supports conversion of unit specifications between formatted and binary forms, arithmetic manipulation of units, and conversion of values between compatible scales of measurement. See http://www.unidata.ucar.edu/software/udunits/ for further documentation and for download.
Uncompress the file, go inside the directory (e.g., cd /Users/matteo/Downloads/udunits-2.1.24) and then type the following commands: $ ./configure --prefix=/Users/matteo/local $ make check install-html install-pdf
