Overview

Our recommended approach to compile Met.3D from source and/or to set up a development environment under Linux is using conda. The conda system provides package management that is independent from your Linux system and safely keeps all packages in an environment. This way, everything you install for Met.3D will not interfere with your base system. Also, using conda is independent of your Linux distribution, hence the described approach should work with any Linux distribution and version.

The installation described here works for Met.3D 1.7 (note that is does not work with the 1.6 versions).

Most dependencies for Met.3D are available as conda packages. After you have created a new conda environment for Met.3D (Step 1), you need to install these dependencies (Step 2). Some dependencies are not (yet) available via conda and need to be installed from source (Step 3). Once this is completed, Met.3D sources can be checked out from the git repository and be compiled (Step 4).

If you haven't done so yet, you need to install conda first. Here, we use the miniconda distribution. We recommend to install miniconda into a directory that provides enough disk space (default is in you home directory, you may want to use a different directory).

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh

Setting up a development environment and compiling Met.3D

Step 1: Create and activate a fresh conda environment

conda create -n met3d
conda activate met3d

Step 2: Install dependencies and development packages

Note: The following installation command may take a while, since all packages need to be downloaded and installed.

conda install -c conda-forge cxx-compiler fortran-compiler make cmake pkg-config gdb glew log4cplus libgdal eccodes freetype gsl proj qt git mesa-libgl-devel-cos7-x86_64 mesa-dri-drivers-cos7-aarch64 libxau-devel-cos7-aarch64 libselinux-devel-cos7-aarch64 libxdamage-devel-cos7-aarch64 libxxf86vm-devel-cos7-aarch64 libxext-devel-cos7-aarch64 xorg-libxfixes xorg-libxau 

Step 2a: Met.3D now has python interface built-in and this necessitates the following  additional dependencies to be installed.

conda install -c conda-forge python pybind11 eigen


Step 3: Manual installation of dependencies not available via conda

# Create a "met.3d-base" directory in your home directory, with sub-dirs "local" and "third-party".
cd ~
mkdir met.3d-base && cd met.3d-base
mkdir local
mkdir third-party

# Checkout and install glfx.
cd ~/met.3d-base/third-party/ 
git clone https://github.com/maizensh/glfx.git
cd glfx
cmake -DCMAKE_INSTALL_PREFIX:PATH=~/met.3d-base/local CMakeLists.txt
make -j 12
make install

# Download and install QCustomPlot (download packages from website):
cd ~/met.3d-base/third-party/
wget https://www.qcustomplot.com/release/2.1.0fixed/QCustomPlot.tar.gz
wget https://www.qcustomplot.com/release/2.1.0fixed/QCustomPlot-sharedlib.tar.gz
tar xvfz QCustomPlot.tar.gz
tar xvfz QCustomPlot-sharedlib.tar.gz
mv qcustomplot-sharedlib/ qcustomplot/

cd qcustomplot/qcustomplot-sharedlib/sharedlib-compilation/
qmake
make -j 12
cp libqcustomplot* ~/met.3d-base/local/lib/
cd ../..
cp qcustomplot.h ~/met.3d-base/local/include/

# NetCDF4 C++ API is not available in latest version from conda.
cd ~/met.3d-base/third-party/
wget https://downloads.unidata.ucar.edu/netcdf-cxx/4.3.1/netcdf-cxx4-4.3.1.tar.gz
tar xf netcdf-cxx4-4.3.1.tar.gz
cd netcdf-cxx4-4.3.1
# !! Change <your user> to the correct path in the following command:
./configure --prefix=/home/<your user>/met.3d-base/local
make -j 12
make install

# section C), download remaining third-party dependencies
cd ~/met.3d-base/third-party
git clone https://github.com/qtproject/qt-solutions.git
 
wget http://ftp.gnu.org/gnu/freefont/freefont-ttf-20120503.zip
unzip freefont-ttf-20120503.zip
 
mkdir naturalearth
cd naturalearth
wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_coastline.zip
unzip ne_50m_coastline.zip
wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_boundary_lines_land.zip
unzip ne_50m_admin_0_boundary_lines_land.zip
wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/raster/HYP_50M_SR_W.zip
unzip HYP_50M_SR_W.zip

Step 4: Checkout and compile Met.3D

cd ~/met.3d-base/
git clone https://gitlab.com/wxmetvis/met.3d.git
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_PREFIX_PATH=~/met.3d-base/local ../met.3d
make -j 12

Running Met.3D

# Make sure your "met3d" conda environment is activated!
# The Met.3D binary is now located at "~/met.3d-base/build/". To run:
cd ~/met.3d-base/build/
MET3D_HOME=~/met.3d-base/met.3d MET3D_BASE=~/met.3d-base ./Met3D

Using QtCreator within the conda envionment for development

This section is only relevant if you want to contribute to Met.3D development using the QtCreator IDE.

Unfortunately, there is no conda package for QtCreator, hence the system installation needs to be used (Ubuntu and OpenSuSE provide QtCreator through their package managers). When using the above conda environment for development, you need to make sure that QtCreator sees the correct development paths.