Compile Met.3D from source code: Linux (conda)

This page describes how to setup a development environment to compile Met.3D from its source code using conda under Linux. If you would like to simply use the software, please use the precompiled binary package instead. If you would like to use a specific branch, or change parts of the source code yourself, this page is for you.

Our recommended approach for setting up a development environment for Met.3D under Linux is using the conda system via mamba. Conda provides package management that is independent from your Linux distribution 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. Mamba is a fast alternative to conda that is fully compatible with the conda system.

Important

The installation procedure described here works for Met.3D v1.16 and higher versions. With version 1.16, we have updated to Qt6. If you would like to build 1.15 or an earlier version of Met.3D with Qt5, please refer to earlier versions of this page (before 17 June 2025) in the documentation repository (https://gitlab.com/wxmetvis/met.3d.docs). Note that the installation procedure described here does not work at all for version 1.6 and earlier.

1) Check GPU requirements and 2) Setup miniforge

First, follow steps 1) and 2) as described for the precompiled binary package to check you GPU installation and to install miniforge.

Important

In the following, we assume that you use the miniforge distribution with mamba.

2) Clone the Met.3D repository

Once the development environment exists, checkout the Met.3D repository:

# Create a "met.3d-base" directory in your home directory and clone the repository.
cd ~
mkdir met.3d-base
cd ~/met.3d-base/
git clone https://gitlab.com/wxmetvis/met.3d.git
cd met.3d

3) Setup a conda development environment for Met.3D

You can setup your conda environment one of two ways:

  1. Using our conda_environment.yaml file provided in the Met.3D repository or,

  2. Manually using the steps described here.

3a) Preconfigured environment

To use the conda_environment.yaml file, which automatically sets up a working environment, run the following command in the Met.3D repository:

mamba create -n met3d -f conda_environment.yaml
mamba activate met3d

You can now proceed to 4).

3b) Manually created environment

Alternatively, create and activate a new conda environment using mamba:

mamba create -n met3d
mamba activate met3d

Next, install dependencies and development packages available via conda. Most dependencies for Met.3D are available as conda packages. Note that the following installation command may take a while, since all packages need to be downloaded and installed:

mamba install cxx-compiler fortran-compiler unzip make ninja cmake pkg-config gdb log4cplus libgdal eccodes netcdf-cxx4 gsl proj "qt6-main=6.11" qt6-advanced-docking-system qt6-multimedia qt6-charts 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 pybind11 xarray netcdf4 metpy libzip tinygltf

4) Compile third-party dependencies

Some dependencies are not (yet) available via conda and need to be installed from source: glfx an OpenGL shader library (note that we use our own fork with some changes), the freefont package for text labels, naturalearth data for coastlines and basemap files, and the ScientificColourMaps package for, as the name says, colour maps. Here, we install everything into a directory met.3d-base in your home directory. This, of course, can be a different directory as well:

# Go to the "met.3d-base" directory in your home directory, and create sub-dirs "local" and "third-party".
cd ~/met.3d-base
mkdir local
mkdir third-party

# Checkout and install glfx.
cd ~/met.3d-base/third-party/
git clone https://github.com/thorwin-vogt/glfx.git --branch qt6
cd glfx
cmake -DCMAKE_INSTALL_PREFIX:PATH=~/met.3d-base/local -G Ninja CMakeLists.txt
ninja
cmake --install .

Note

Some additional dependencies, like colourmaps, are downloaded automatically during the CMake configuration process. You can specify the download location by setting the MET3D_BASE environment variable. This is optional. If MET3D_BASE is not set, Met.3D’s cmake script downloads them to the third-party directory in the Met.3D repository.

5) Compile Met.3D

Once the development environment exists, you can compile Met.3D:

cd ~/met.3d-base/
cd met.3d
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_PREFIX_PATH=~/met.3d-base/local -G "Ninja" ../
ninja

6) Run Met.3D

You should now be able to run Met.3D:

cd ~/met.3d-base/met.3d/build
./Met3D

Important

If you previously set MET3D_BASE for the third-party dependencies, you must also set it when running Met.3D.

Warning

If your build directory is not located in the root of the repository, you must set the environment variable MET3D_HOME to the Met.3D repository:

MET3D_HOME=~/met.3d-base/met.3d

Compiling and running Met.3D from within an IDE

If you would like to contribute to Met.3D, we provide guidelines to compile and run Met.3D from within integrated development environments (IDEs) here: Set up a Linux (conda) development environment for Met.3D.