skip to content

NetCDF is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.

Instructions for users: 

Load the appropriate modules on bionic and/or use the system version on focal. Note that in newer versions of the NetCDF software, the C library and Fortran interface are distributed as separate packages with separate version numbers. The Fortran interface depends on the C interface.

The 'compilertype' needs to match the compiler family you want to use, eg 'intel' for Intel compilers. Once you have loaded the modules, the nc-config and nf-config commands will tell you how to link the library.

Admin notes: 

There are actually two libraries, libnetcdf and libnetcdff. The latter is the Fortran interface. They each have their own independent version numbers. Query with n{c,f}-config --version (the version numbers of the .so files do not match the declared versions!). The libraries for our bionic image were - mistakenly in my view - packaged together despite them not sharing a version number.

To build this you first need to build szip, then hdf5, and then netcdf. Although Ubuntu has its own copy of these libraries, it doesn't have the Fortran interfaces built for other compilers than gfortran. Our versions are also newer.

module purge 
#module add szlib # on 18.04 use szlib2 system package
module add hdf5/gnu

# unpack C interface 
time ./configure --prefix=/usr/local/shared/ubuntu-18.04/x86_64/netcdf/gnu/4.6.1 --enable-netcdf-4 
# 26s
time make 
# 1m17s
time make check
#6m5s  FAIL: tst_remote3; see ncdap_test/test-suite.log
time sudo make install 
# create environment module for the C interface before proceeding
# unpack Fortran interface, set environment to see C interface 
module add hdf5/gnu netcdf/gnu
time ./configure --prefix=/usr/local/shared/ubuntu-20.04/x86_64/netcdff/gnu/4.5.4
time make
time make check
time sudo make install

Now clean up everything, environment included:

cd ..
find . -mindepth 0 -maxdepth 1 -type d -name 'netcdf*' -delete
# re-extract the tarballs
module purge
# module add szlib 
module add icc/64/2022/0/1 
module add hdf5/intel 
cd netcdf-c-4.8.1
time CC=icc FC=ifort ./configure --prefix=/usr/local/shared/ubuntu-20.04/x86_64/netcdf/intel/4.8.1 --enable-netcdf-4 
time make
time make check
time sudo make install
# unpack Fortran interface, build+install module file for C interface and set environment to see intel C interface
module add netcdf/intel
time CC=icc FC=ifort ./configure --prefix=/usr/local/shared/ubuntu-20.04/x86_64/netcdff/intel/4.5.4 --enable-netcdf-4
time make 
time make check
time sudo make install

System status 

System monitoring page

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.