Installing Netcdf/NCO/CDO/RegCM tools

A short hands on how to install the software we need to manipulate climate data

Module loading

If you have Environment Modules, be sure to load the proper module for the next step. Every package in this page will be compiled using GCC 4.7.2:

module load gnu/4.7.2

Upgrading gcc/gfortran suite on centos6.4

We need a more recent version for both gcc and gfortran compiler to compile and then run regcm4. For this reason we will use devtool repo to enable and use on our system a more recent gnu compiler suite. To do this do the following:

>wget -O /etc/yum.repos.d/devtools-1.1.repo

The above command will setup a devtools repository where recent and update sof tware developing tools are maintained. Now we can install the devtoolset:

>yum install devtoolset-1.1

We will now enable the software we just installed using the scl tool ( see

>scl enable devtoolset-1.1 bash

And now let us test our gcc and/or gfortran version we have:

> gfortran -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/centos/devtoolset-1.1/root/usr --mandir=/opt/centos/devtoolset-1.1/root/usr/share/man --infodir=/opt/centos/devtoolset-1.1/root/usr/share/info --with-bugurl= --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --disable-build-with-cxx --disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-ppl --with-cloog --with-mpc=/home/centos/rpm/BUILD/gcc-4.7.2-20121015/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.2 20121015 (Red Hat 4.7.2-5) (GCC)

netcdf library

  • creating a temporary directory:

    > mkdir netcdf
    > cd netcdf
  • getting the library from UNIDATA:

    > wget
    > wget
  • check and get dependencies

    • is curl library installed?:

      > yum install curl.x86_64 curl-devel
    • is libz installed?:

      > yum install zlib zlib-devel
    • get hdf library:

      > wget
    • unpack./configure and compile hdf library using the GNU 4.7.2 devel suite you already installed (not 4.4.6, the one coming with official CentOS 6.4 repository):

      > module load gnu/4.7.2
      > tar -xvzf hdf5-1.8.12.tar.gz
      > cd hdf5-1.8.12
      > ./configure CC=gcc FC=gfortran --prefix=/opt/hdf5/1.8.12/gnu
      > make
      > make check
      > make install
  • now go to netcdf library:

    > tar -xvzf netcdf.tgz
    > cd netcdf
    > ./configure --prefix=/opt/netcdf/4.3.0/gnu  --enable-netcdf-4 --enable-dap  CPPFLAGS=-I/opt/hdf5/1.8.12/gnu/include/ LDFLAGS=-L/opt/hdf5/1.8.12/gnu/lib/
    > make
    > make check
    > make install
  • and the for netcdf-fortran:

    > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/netcdf/4.3.0/gnu/lib
    > ./configure FC=gfortran --prefix=/opt/netcdf/4.3.0/gnu/ CPPFLAGS=-I/opt/netcdf/4.3.0/gnu/include LDFLAGS=-L/opt/netcdf/4.3.0/gnu/lib
    > make && make check && make install
  • setup modules..

    We need to setup an appropriate module..

Open MPI

Visit the official home page and download the latest stable version (1.6.5 in november 2013):

> wget

then wget it uncompress it:

> tar -zxvf openmpi-1.6.5.tar.gz

once in the directory 'openmpi-1.6.5' dont forget to install the following lib:

> yum install libsysfs libsysfs-devel libibverbs libibverbs-devel

> ./configure CC=gcc FC=gfortran --prefix=/opt/openmpi/1.6.5/gnu/4.7.2/torque --with-tm=/opt/torque/4.2.6 --with-openib

> make -j 2
> make check
> script ___install.log -c 'make install'

installing cdo:

Before install cdo, you need to install the GRIB API. Check this link on how to do it:

Before installing the GRIB API you need the package jasper and gsl installed by yum:

> yum install gsl-devel.x86_64 gsl.x86_64 jasper-libs.x86_64 jasper.x86_64 jasper-devel.x86_64
> tar -xvzf grib_api-1.11.0.tar.gz
> cd grib_api-1.11.0
> ./configure --prefix=/opt/grib_api/1.11.0/gnu
> make
> make check
> make install

Then you can proceed to get the CDO package:

> wget

- unpack and configure::

      > tar -xvzf cdo-1.6.2.tar.gz
      > cd cdo-1.6.2
      > ./configure --with-netcdf=/opt/netcdf/4.3.0/gnu/ --with-grib_api=/opt/grib_api/1.10.4/gnu/ --prefix=/opt/cdo/1.6.2/gnu

- compile/check and install::

      > make
      > make check
      > make install

- create module::

      to write down something for this

installing nco:

  • install prerequisite:

    > yum install antlr antlr-C++
    > yum install libuuid-devel.x86_64
    > yum install libxml2 libxml2-devel
    > yum install cppunit cppunit-devel  (to test dap package)
  • get and installl dap library:

    > wget
    > tar -xvzf libdap-3.12.0.tar.gz
    > cd libdap-3.12.0
    > ./configure CC=gcc FC=gfortran --prefix=/opt/libdap/3.12.0/gnu
    > make
    > make install
  • get and install udinits:

    > wget
    > ./configure --prefix=/opt/udunits/2.1.24
    > make
    > make install
  • get and install gsl:

    > wget
    > tar -xvzf gsl-1.16.tar.gz
    > ./configure --prefix=/opt/gsl/1.16/gnu
    > make
    > make check
    > make install
  • and finally:

    > wget
    > tar -xvzf nco-4.3.8.tar.gz
    > cd nco-4.3.8
    > export  GSL_LIB="/opt/gsl/1.16/lib -lgsl -lgslcblas -lm"
    > export NETCDF4_ROOT="/opt/netcdf/4.3.0/gnu/"
    > export  NETCDF_INC="/opt/netcdf/4.3.0/gnu/include"
    > export NETCDF_LIB="/opt/netcdf/4.3.0/gnu/lib"
    > export GSL_INC="/opt/gsl/1.16/include"
    > export GSL_LIB="/opt/gsl/1.16/lib -lgsl -lgslcblas -lm"
    > export GSL_ROOT="/opt/gsl/1.16"
    > export UDUNITS2_PATH="/opt/udunits/2.1.24/"
    > ./configure CC=gcc FC=gfortran --prefix=/opt/nco/4.3.8/
    > make
    > make check
    > make install
  • In order to make the access of the applications permamnent a the prompte you need to add this line

    > echo "export PATH=$PATH:/opt/nco/4.3.8/bin/:/opt/cdo/1.6.2/gnu/bin:/opt/ncview/2.1.2/bin/" > /etc/profile.d/

Installing RegCM:

  • Before install RegCM, you need to load the module netcdf and openmpi:

    > wget
    > tar -xvzf RegCM-4.4-rc16.tar.gz
    > cd RegCM-4.4-rc16
    > module load netcdf/4.3.0/gnu
    > module load  openmpi/1.6.5/gnu/4.7.2
    > ./configure  --prefix=/opt/RegCM/4.4rc16/gnu MPIFC=/opt/openmpi/1.6.5/gnu/4.7.2/torque/bin/mpif90 --with-netcdf=/opt/netcdf/4.3.0/gnu/
    > make
    > make check
    > make install
  • Testing RegCM:

  • paste the following in a file with the same name as the your '.in' file: example if your file is name then the file will be myjob.job

    #PBS -q batch
    #PBS -l walltime=01:00:00
    module load regcm/4.4-rc16/gnu
    mpirun regcmMPI
    echo Master process running on `hostname`
    echo Directory is `pwd`
    echo PBS has allocated the following nodes:
    echo `cat $PBS_NBODEFILE`