Skip to content

Compiling MeteoIO

Once you have the source code of MeteoIO on your computer (either from downloading a source package or from performing a git clone, see Getting MeteoIO, you can compile it.

Compiling

You need to have the following tools on your system:

  • cmake (it is highly recommended to also install cmake-curses or cmake-gui);
  • a c++ compiler, for example g++;
  • if you want to generate the documentation, doxygen;
  • if you have latex, this is a plus since it will be able to render some equations in the documentation.

Then, you are ready to compile MeteoIO:

  • open a terminal and change into the trunk folder of meteoio
  • ccmake . (or cmake-gui .)
  • Press [c] to configure, it will then populate the screen with configurable options
  • choose the relevant options (toggle ON/OFF by pressing Enter)
  • Press [c] to configure
  • Do not forget to configure the install path (either system wide if you have access to system rights or in a local directory where you have write permission)
  • Press [g] to generate and exit the interface (you might have to press [c] a few times for it to have everything finally setup)
  • make

Once MeteoIO has been compiled, you can install it. As previously mentioned, there are two options: you install in a system directory (and you need system rights, either through sudo or as root) or you don't:

  • sudo make install
  • sudo ldconfig (if your install path is already listed in /etc/ld.so.conf. If not, add it to this list before running ldconfig). If your location is too exotic, other softwares won't be able to find MeteoIO by themselves. In such a case also set LD_LIBRARY_PATH as laid out here below so other softwares will be able to find it automatically (by expanding LD_LIBRARY_PATH)
  • make install
  • export LD_LIBRARY_PATH={your install prefix path}/lib:$LD_LIBRARY_PATH (for bash shell). This can be put into your $HOME/.bashrc or $HOME/.profile in order to become permanent for your account.
  • export PATH={your install prefix path}/bin:$PATH (for bash shell). This can be put into your $HOME/.bashrc or $HOME/.profile in order to become permanent for your account. By default, MeteoIO will be searched for in ${HOME}/usr so this could be a good location to install it.

Afterward, the examples can be compiled (see below).

Please note that this is still experimental at this point. You need to install the following components:

Unpack these three packages, and following along these lines, set a few environment variables (it seems that setting ANDROID_NKD to point to the root of your ndk is enough for cmake-android to find what it needs, without relying on ANDROID_NDK_... and ANDTOOLCHAIN that were not working with ndk version 7).

Then, compile with android-cmake (you can then use ccmake . to change options in a more user-friendly way, after you used android-cmake the first time) and make.

You need to have the following tools on your system:

  • cmake;
  • a c++ compiler, among others, you can use Code::Blocks, MinGW, Visual C++. See links and detailed instructions below.
  • if you want to generate the documentation, doxygen;
  • if you have latex, this is a plus since it will be able to render some equations in the documentation.

Then, you are ready to compile MeteoIO:

  • Start CMake and set the source path to your local MeteoIO trunk and set the trunk directory as build directory. Click on "Configure" and select the appropriate compiler according to what you have. If you want to build the documentation (see at the bottom of this page), you need to have installed doxygen before running cmake (or you have to run it again once doxygen has been installed).
  • Then, depending on you compiler (either Code::Blocks, MinGW or Visual C++):
  • It can be downloaded free at www.codeblocks.org. We highly recommend to download the full package (ie: the one containing MinGW)
  • when installing Code::Blocks, the MinGW installation might have to be tweaked as explained below in the MinGW section (if the package has not been fixed)
  • In CMake, select "Code::Blocks - MinGW Makefiles" as the generator
  • Click on "Generate"
  • Open the project file (ending in .cbp) with Code::Blocks and compile it
  • It can be downloaded free at MinGW
  • IMPORTANT: When installing MinGW make sure that you install MinGW together with MinGW make and add the MinGW bin directory to your PATH environment variable
  • create a shortcut (or simply a copy) named make.exe in the MinGW bin directory pointing to mingw-make.exe in the same directory
  • In CMake, select "MinGW Makefiles"
  • in CMake, click on "Generate"
  • Run cmd.exe, change into the build directory as specified for CMake (e.g. trunk) and run "mingw32-make"
  • It can be downloaded free at Microsoft, after registration (this is not open source software!)
  • In CMake, select "Visual Studio XX" where XX is your version
  • in CMake, click on "Generate"
  • open the project file (ending in .sln) with Visual C++ and compile

Afterward, the examples can be compiled (see below).

You need to have the following tools on your system:

  • cmake. It is highly recommended to check the box to install both the GUI and the command line tools and to click on "yes" to have it in your path (if this is not done automatically, you will have to add it to your path manually, see below);
  • a c++ compiler, either XCode command line tools (recommended) or the full XCode (you can get a version for free after registering at http://connect.apple.com or directly with a list of versions and operating system versions combinations at https://xcodereleases.com/) or Clang (available through macports);
  • Launch a terminal;
  • type the following command: xcode-select --install
  • in the dialogue window that opens, select "Install", do not select "get Xcode". This is a relatively small install, it should download and install quite quickly.
  • Run it once and select "install" in Preferences > Downloads > Components > Command Line Tools;
  • open a terminal and type the following commands;
    • install clang: sudo port install clang;
    • set mac ports clang as clang compiler: sudo port select --set clang mp-clang-5.0 (you can get a list of all installed versions by typing: sudo port select --list clang);
    • check that the right clang is found: clang --version and clang++ --version (the output should start with clang version XXX and not with Apple LLVM version XXX. If it doesn't work, try run export PATH=/opt/local/bin:/opt/local/sbin:$PATH. You can add it to ~.bash_profile to have it permanently);
    • set it as default compiler: export CC=clang and export CXX=clang++ (You can add it to ~.bash_profile to have it permanently);
    • If you've already compiled the project with XCode, run rm -r CMakeFiles CMakeCache.txt from the trunk directory;
  • Extras:
    • if you want to compile some plugins like netcdf, png, etc it is recommended to install the required dependencies through macport
    • if you want to generate the documentation, doxygen. In such a case, you need to create a symlink to the doxygen binary in /usr/bin or add it to your path (see below);
    • if you have latex, this is a plus since it will be able to render some equations in the documentation.

Then, you are ready to compile MeteoIO:

  • open a terminal and change into the trunk folder of meteoio
  • ccmake . (or cmake-gui .)
  • Press [c] to configure, it will then populate the screen with configurable options
  • choose the relevant options (toggle ON/OFF by pressing Enter)
  • Press [c] to configure
  • Do not forget to configure the install path (either system wide if you have access to system rights or in a local directory where you have write permission)
  • Press [g] to generate and exit the interface (you might have to press [c] a few times for it to have everything finally setup)
  • make

Once MeteoIO has been compiled, you can install it. As previously mentioned, there are two options: you install in a system directory (and you need system rights, either through sudo or as root) or you don't:

  • sudo make install
  • make install
  • export DYLD_FALLBACK_LIBRARY_PATH={your install prefix path}/lib:$DYLD_FALLBACK_LIBRARY_PATH (for bash shell). This can be put into your $HOME/.bash_profile in order to become permanent for your account (this file might have to be created, see tech-recipes.com).
  • export PATH={your install prefix path}/bin:$PATH (for bash shell). This can be put into your $HOME/.bash_profile in order to become permanent for your account (this file might have to be created, see tech-recipes.com). By default, MeteoIO will be searched for in ${HOME}/usr so this could be a good location to install it.

Afterward, the examples can be compiled (see below).

Follow the documentation for Linux (although the compiler is clang).

Follow the documentation for Windows.

Follow the documentation for Linux.

Compiling and using other resources

You can generate the documentation from your version of the source code. You can also compile and learn from a few simple examples that are provided in doc/examples and are useful to learn how to use MeteoIO in your own code. These examples shown various usage of MeteoIO and yet are very simple and short, so feel free to open their source code!

Generating the documentation

In order to be able to generate the documentation, you need to install doxygen on your system. You also need to re-run cmake after doxygen has been installed, so doxygen support will be enabled. Then, simply type make doc in a terminal window (from MeteoIO's root directory) and doxygen will prepare the online documentation that will be accessible through doc/MeteoIO_doc.html

Compiling the examples

The examples are compiled in a way very similar to MeteoIO itself, by running cmake and then compiling the project (same as explained above for compiling MeteoIO).

  • the MeteoIO library must habe been installed (with make install) to a system path or LD_LIBRARY_PATH set to the path where the library is located;
  • in a terminal, go into the doc/examples directory;
  • run ccmake . (nothing needs to be changed, but press "c" twice and then "g" to generate the project files);
  • compile with make.
  • manually copy lib/libmeteoio.dll in doc/examples;
  • run cmake and give it the path to the examples;
  • nothing needs to be changed, but press "c" twice and then "g" to generate the project files;
  • compile the generated project;
  • make sure that DYLD_FALLBACK_LIBRARY_PATH has been set to the path where the MeteoIO library is located (see above);
  • in a terminal, go into the doc/examples directory;
  • run ccmake . (or cmake-gui .), nothing needs to be changed, but press "c" twice and then "g" to generate the project files;
  • compile with make.

Running the examples

Every example shows a different aspect of MeteoIO, therefore they all take different arguments. But a generic io.ini file is provided alongside input data that works for all the provided examples. The meteo data covers the range 2008-12-01 to 2009-01-31.

  • in a terminal, go to the examples directory;
  • run the chosen example with its required arguments, for example:
    • on Linux, ./meteo_reading 2008-12-15T12:30;
    • on Windows, meteo_reading.exe 2008-12-15T12:30
    • on OsX, ./meteo_reading 2008-12-15T12:30.

The meteo_reading example prints on the screen the metadata for each station as well as all the available, filtered and re-interpolated meteorological data for the date and time specified as argument. Of course, the other examples do other things!

Running the meteoio_timeseries application

This is a small application that is compiled by default with MeteoIO and that you can use for converting or processing timeseries. It can be used on a workstation (either from the command line or from Inishell) as well as on a server for on-demand data processing (in a docker container or installed as any other application). Running it without any arguments gives the following help text that describes the supported arguments:

Usage: meteoio/bin/meteoio_timeseries
        [-b, --begindate=YYYY-MM-DDTHH:MM] (e.g.:2007-08-11T09:00)
        [-e, --enddate=YYYY-MM-DDTHH:MM] (e.g.:2008-08-11T09:00 or NOW)
        [-d, --duration=<in days>] (e.g.: 30)
        [-c, --config=<ini file>] (e.g. io.ini)
        [-s, --sampling-rate=<sampling rate in minutes>] (e.g. 60)
        [-o, --output-buffer=<output buffer size in number of timesteps>] (e.g. 24, requires APPEND mode enabled in output plugin)
        [-p, --progress] Show progress
        [-t, --timeout] Kill the process after that many seconds if still running
        [-v, --version] Print the version number
        [-h, --help] Print help message and version information

If the key DATA_QA_LOGS in the [General] section is set to true, you can provide a list of
meteo parameters to check for valid values in the CHECK_MISSING key of the [Input] section.
You can define the output sampling rate in the SAMPLING_RATE_MIN key of the [Output] section
but the command line parameter has priority.
Example use:
        meteoio/bin/meteoio_timeseries -c io.ini -b 1996-06-17T00:00 -e NOW