MET Online Tutorial for METv2.0
Compilation: Required Libraries
Get Required Libraries
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)
MET is compatible with NetCDF version 3 but not with the beta release of NetCDF version 4.
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
-
pgcc -c -DUNDERSCORE *.c
pgf77 -c -DUNDERSCORE -Mnosecond_underscore *.f *.F
ar crv libbufr.a *.o
-
icc -c -DUNDERSCORE *.c
ifort -c -DUNDERSCORE *.f *.F
ar crv libbufr.a *.o
-
xlc -c -DUNDERSCORE *.c
xlf -c -qextname *.f *.F
ar crv libbufr.a *.o
Warnings may be encountered when compiling a few of the BUFRLIB files but they may be ignored.
For users with 64-bit machines, you will need to build BUFRLIB and MET as 32-bit in order to run the PB2NC tool. If you do not plan to use PrepBufr point observations with MET, you may skip the compilation of BUFRLIB and set the DISABLE_PB2NC flag in the top-level MET Makefile. Otherwise, please refer to the note about Running MET on 64-bit Machines.
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 may want 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 arguement.
The following is a summary of these steps for 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.
PGI users should download and compile GSL-1.11 since GSL-1.12 doesn't build correctly with PGI.
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.
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.
The F2C Library may not be required depending on which Fortran compiler is used. It is not necessary when using the GNU gfortran and PGI pgf77 compilers but is required for the GNU g77 compiler.

