Overview
From the 2.22.0 version, Magics will be using CMake for its compilation and installation. This is a first step towards an homogenisation of the installation procedures for all ECMWF packages.
Binary versions
Before you install from source code you might want to check that already compiled binary versions are available to you. Magics and third-party dependent software packages might be available as binary packages for you platform in form of RPMs or Debian packages . You might find them by going to the software search services, such as for OpenSuSE and SLES at http://software.opensuse.org/search (select "Search options" - "Include users' home projects"). Ubuntu for Linux. Ubuntu maintains a Magics version in their system default repository.
...
Installing Magics through conda and pip
If you want to use Magics only through Python you have now choices to install Magics with your favourite Python package manager. With the release of Magics 4.0.0 (Feb 2019), the Python interface is separated from the library. This allowed the packaging through pip and conda.
Using pip
When using pip it is required to have the Magics library installed on the system!
Code Block |
---|
pip install Magics |
Ref: https://pypi.org/project/Magics/
Using conda
Conda will install the Magics library and all its dependencies for you. Please make sure to activate you conda environment before running your python program.
Code Block |
---|
conda install -c conda-forge Magics
conda activate
python my-magics-script.py |
Building Magics from source yourself
Requirements
The following table lists the dependency Magics requires to be build from source. Please note, if you install these this package from source you also might have to install the respective "-devel" packages of dependencies.
Compilers | |||
---|---|---|---|
C++ | http://gcc.gnu.org/ |
The compiler must support C++ 17. GCC supports it from version 7 | |
Fortran | http://gcc.gnu.org/fortran/ |
Only needed to run Fortran tests | |||
Utilities |
---|
cmake |
https:// |
cmake.org |
version > 3.12 |
Third party libraries | |||
---|---|---|---|
proj |
https:// |
proj.org |
to handle projections |
netcdf | http://www.unidata.ucar.edu/software/netcdf/ |
for netcdf support needed Please note: You also need to install the legacy C++ interface and HDF5 | |
cairo + pango | https://www.cairographics.org http://www.pango.org/ |
for png/pdf support needed | |||
expat | http://expat.sourceforge.net/ | for XML parsing | |
ECMWF libraries |
---|
ecCodes | ECC | Enables GRIB and BUFR support | |
odc | odc on GitHub | if ODB support needed |
Include Page | ||||
---|---|---|---|---|
|
Magics specific CMake options
After changing into the build Magics directory, the user user has to run CMake with his/her own options. The command gives feedback on what requirements are fulfilled and what software is still required. Table below gives an overview of the different options of configure. The default (without any options) will compile a share library only and install it in /usr/local/.
cmake options | doc | default |
---|
ENABLE_GRIB
ECCODES_PATH | where to find |
eccodes ( if non-standard installation ) |
ENABLE_NETCDF | enable netcdf support | on |
NETCDF_PATH | where to find netcdf ( if non-standard installation ) |
ENABLE_ODB | enable odb support | off |
ODB_API_PATH | where to find odb |
enable bufr support
The bufr support is done through emoslib .
( if non-standard installation ) |
ENABLE_FORTRAN | enable fortran interface | on |
ENABLE_METVIEW | enable metview support(and Qt support) | off |
ENABLE_CAIRO | enable |
Cairo support | on |
PROJ4_PATH | where to find proj4 ( if non-standard installation ) |
To make sure that a feature is really enabled, you will have to specify with the option ex: -DENABLE_GRIBNETCDF=ON. In that case CMake will fail if the grib NetCDF support can not cannot be enabled.
Testing your build
The Magics code contains a directory called test in which, in separate sub-directories, tests for the various interfaces of Magics are provided. Test programs in Fortran , and C , Python and MagML are compiled and run if MAGPLUS_HOME=$PWD make check is invoked from the root directory. (Note that the MAGPLUS_HOME needs to be set!)
The output of the tests should verified before the library is installed. This setup does not check if the user setup is correct, but the code in test can be used to do so. More examples of source code can be found on the Magics web gallery
Installation FAQ
Why do I get the error message while loading shared libraries: libMagPlus.so.1: cannot open shared object file: No such file or directory when running a Magics executable?
You need to alter your $LD_LIBRARY_PATH variable, as described in section “User setup”. The variable needs to contain the path to your Magics library.
Why do I get a message about a missing / not found libpgc.so when trying to run a Magics executable?
If your EmosLib is compiled with Portland’s Pgf90, it requires this library as shared library at run-time. You need to alter your $LD_LIBRARY_PATH variable.
How can I change the coastline files?
Coastline files are given in Shape file format. The GIS data was taken from http://www.naturalearthdata.com.
Can I add GIS information, such as rivers and borders to my plots?
Yes. Information about political borders and rivers have been added with the new coastline files.
Why have the Printercap file and the frame in my PostScript disappeared?
With version 2.4 of Magics we have changed the set-up of how the PostScript driver was internally organised. The Printercap configuration file was created in the past to accommodate differences between printers. This is nowadays no issue any more. Out of the same reason PostScript output was scaled down to 95% to allow room for Printer alignment problems. From version 2.4 onwards the scaling is, as in all other drivers, set back to 100% of the page size.
Why did version 2.6 of Magics was followed by version 2.8?
With Magics 2.4 we introduced a new numbering scheme where the sub version indicates how stable the version of Magics is. Odd numbers (2.5, 2.7, …) indicate unstable development versions and even numbers (2.4, 2.6, 2.8, …) indicate versions we think are stable and tested enough to be used in your applications.
How can I report bugs or ask for help?
Please write an email to magics@ecmwf.int . Please compress any larger files you might need to attach with gzip .