MET Online Tutorial

MET Online Tutorial for METv3.0

Compilation: Required Libraries

Get Required Libraries

Up to four external libraries are required for compiling/building MET and should be downloaded and installed before attempting to install MET. Many users may already have one or more of the required libraries on their system. In particular, WRF users will likely already have NetCDF built for use with WRF. However, users must ensure that the following libraries are built on their machines using the *same* family of compilers that will be used to build MET (recommend GNU or PGI compilers):
  • NCEP's BUFRLIB
  • Unidata's NetCDF library
  • The GNU Scientific Library (GSL)
  • The F2C (or G2C) library (Not required for many compilers)

arrow MET is compatible with NetCDF versions 3 and 4, but version 4 may require additional configuration arguments. See section on Compiling NetCDF below.

Environment Settings

When building MET and its required libraries on an IBM, in particular an NCAR supercomputer, the OBJECT_MODE should be set in your enviroment to 32.

Compiling BUFRLIB

NCEP's BUFRLIB is used by MET to decode point-based observation datasets in PrepBufr format. Once you have downloaded and unpacked the BUFRLIB tarball, refer to the README_BUFRLIB file. Users should use the compilation options listed below for each compiler. Once built, MET expects the BUFRLIB archive file to be named libbufr.a.

Unpacking the BUFRLIB tarball consists of the following 3 steps:
  • Make a new directory to contain the BUFRLIB code (e.g. mkdir /home/user/BUFRLIB).
  • Move the BUFRLIB tarball to the new directory (e.g. mv BUFRLIB.tar /home/user/BUFRLIB/.).
  • Unpack the tarball (e.g. cd /home/user/BUFRLIB; tar -xvf BUFRLIB.tar).

Next, compile BUFRLIB using a C and a FORTRAN compiler.

Compiling BUFRLIB using the GNU gcc and gfortran compilers consists of the following 3 steps:
    gcc -c -DUNDERSCORE *.c
    gfortran -c -DUNDERSCORE -fno-second-underscore *.f *.F
    ar crv libbufr.a *.o

arrow If compiling BUFRLIB with the GNU gfortran compiler, see the known issues page for a bug fix.

Compiling BUFRLIB using the PGI pgcc and pgf77 compilers consists of the following 3 steps:
    pgcc -c -DUNDERSCORE *.c
    pgf77 -c -DUNDERSCORE -Mnosecond_underscore *.f *.F
    ar crv libbufr.a *.o
Compiling BUFRLIB using the Intel icc and ifort compilers consists of the following 3 steps:
    icc -c -DUNDERSCORE *.c
    ifort -c -DUNDERSCORE *.f *.F
    ar crv libbufr.a *.o
Compiling BUFRLIB on an IBM using the IBM xlc and xlf compilers consists of the following 3 steps:
    xlc -c -DUNDERSCORE *.c
    xlf -c -qextname *.f *.F
    ar crv libbufr.a *.o

arrow Warnings may be encountered when compiling a few of the BUFRLIB files but they may be ignored.

Compiling NetCDF

Unidata's NetCDF libraries are used by several tools within MET for writing output NetCDF files. Users may also find some utilities built for NetCDF such as ncdump and ncview useful for viewing the contents of NetCDF files. Detailed installation instructions are available from Unidata.

Prior to running the NetCDF configure script, users are encouraged to explicitly specify the compilers to be used by setting the following variables:
  • Set CC to the C compiler to be used.
  • Set CXX to the C++ compiler to be used.
  • Set FC to the Fortran compiler to be used (not used by MET) or set to an empty string ("") to disable.
  • Set F90 to the Fortran90 to be used (not used by MET) or set to an empty string ("") to disable.

When running the NetCDF configure script, users may want to pass in the --prefix=/netcdf/install/path command line argument to specify where the NetCDF library should be installed. Users compiling NetCDF version 4.1.1 or later should also use the --disable-netcdf-4 command line argument.

The following is a summary of these steps for building NetCDF version 4 using the C-shell:
    cd /path/to/netcdf
    setenv CC /path/to/c/compiler
    setenv CXX /path/to/c++/compiler
    setenv FC ''
    setenv F90 ''
    ./configure --prefix=/netcdf/install/path --disable-netcdf-4
    make
    make install

Compiling GNU Scientific Library

The GNU Scientific Library (GSL) is used by MET when computing confidence intervals. Precompiled binary packages are available for most GNU/Linux distributions and may be installed with root access. When installing GSL from a precompiled package on Debian Linux, the developer's version of GSL must be used. MET requires access to the GSL source headers and library archive file at build time.

For those who have downloaded and are building the GSL source code locally:

  • In the top-level GSL directory, refer to the README and INSTALL files for instructions.
  • Set CC to the C compiler to be used.
  • Run the configure script.
  • Type make to build the GSL library.

When running the GSL configure script, users may want to pass in the --prefix=/GSL/install/directory command line argument to specify where the GSL library should be installed.

The following is a summary of these steps for building GSL using the C-shell:
    cd /path/to/gsl
    setenv CC /path/to/c/compiler
    ./configure --prefix=/gsl/install/path
    make
    make install

arrow PGI users should download and compile GSL-1.11 since later versions do not build correctly with PGI.

Compiling F2C

The F2C (or G2C) library is used by PB2NC to enable the MET C/C++ code to communicate with BUFRLIB Fortran code. Precompiled binary packages of G2C are available for many GNU/Linux distributions and may be installed with root access. The user may either use one of these precompiled G2C packages or download the F2C source code and build it locally. Please refer to the README file distributed with the tarball for instructions on building F2C locally.

arrow The F2C Library is not necessary for the GNU gfortran, PGI pgf77, and Intel ifort compilers but is required for the GNU g77 and IBM xlf compilers.