Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 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=4.0.0
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 this package from source you also might have to install the respective "-devel" packages of dependencies. 

Compilers
C++http://gcc.gnu.org/ 
Fortranhttp://gcc.gnu.org/fortran/If Fortran or BUFR support needed
Utilities

make

http://www.gnu.org/software/make/ 
cmakehttps://cmake.orgversion >3.1
Python Support
pythonhttp://www.python.org/versions 2.7 and 3.x supported
python-jinja2
pip install jinja2
Third party libraries
projhttp://trac.osgeo.org/proj/Proj4 to handle projections
boosthttp://www.boost.org/used for coastlines
netcdfhttp://www.unidata.ucar.edu/software/netcdf/

if netcdf support needed

Please note: You also need to install the legacy C++ interface and HDF5

pangohttp://www.pango.org/if png/pdf support needed
expathttp://expat.sourceforge.net/for XML parsing
ECMWF libraries
ecCodesECCEnables GRIB and BUFR support 
odb-apiODB-API Homeif ODB support needed

Include Page
SUP:General CMake installation instructions
SUP:General CMake installation instructions

Magics specific CMake options

After changing into the build Magics directory, the 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 optionsdocdefault
ECCODES_PATHwhere to find eccode ( if non-standard installation  ) 
ENABLE_NETCDFenable netcdf supporton
NETCDF_PATHwhere to find netcdf  ( if non-standard installation  ) 
ENABLE_ODBenable odb supportoff
ODB_API_PATHwhere to find odb ( if non-standard installation  ) 
ENABLE_PYTHONenable python interfaceauto
ENABLE_FORTRANenable fortran interfaceon
ENABLE_METVIEWenable metview support(and Qt support)off
ENABLE_CAIROenable Cairo supporton
BOOST_ROOTwhere to find boost ( if non-standard installation  ) 
PROJ4_PATHwhere 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_GRIB=ON. In that case CMake will fail if the GRIB support can not 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, 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 .