Installation guide

A step-by-step instructions to follow in order to install all the required packages and tools.
Example of installation in a Debian 8 as root:
  1. as root
  2. $ su
  3. install subversion, version control packages
  4. # apt-get install subversion
  5. install GIT, different paradigm version control
  6. # apt-get install git
  7. get python and its necessary applications
  8. # apt-get install python python-scipy python-numpy cython cython-dbg
  9. get netcdf libraries tools and applications (cdo and nco are also installed maybe not required...)
  10. # apt-get install netcdf-bin netcdf-dbg libnetcdf-dev netcdf-doc libnetcdff-dbg libnetcdff-dev libnetcdff-doc ncview cdo nco
  11. get hdf5
  12. # apt-get install libhdf5-dev
  13. install matplotlib and basemap in order to plot and drow maps
  14. # apt-get install python-matplotlib python-matplotlib-data python-matplotlib-doc python-mpltoolkits.basemap python-mpltoolkits.basemap-data
  15. install system tools (Scripts use LATEX interface for titles and labels)
  16. # apt-get install dvipng
  17. install netcdf4, python API interface to netCDF files
    1. Some new linux distributions (at least Debian >8) provide the netcdf4 API in the package systems:
    2. # apt-get install python-netcdf4
    3. Otherwise, it can be manually done. Be careful with interferences with anaconda (some issues on mixture of netcdf libraries have been detected). Make sure, that if you use anaconda, that the netcdf libraries installed are with netcdf4 capabilities.
      • Following https://github.com/Unidata/netcdf4-python)
      • # git clone https://github.com/Unidata/netcdf4-python.git
        cd netcdf4-python/
      • Editing `setup.cfg' to add/change some values (there are installation issues if `nc-config' is used along installation)
      • 
        use_ncconfig=False
        netCDF4_dir = /usr/local
        HDF5_dir = /usr/local
        HDF5_libdir = /usr/lib/x86_64-linux-gnu/hdf5/serial
        HDF5_INCDIR = /usr/include/hdf5/serial
        
        # python setup.py build >& run_pysetup.log
        # python setup.py install >& run_pyinstall.log
  18. Getting the scripts, no need to be root:
  19. # exit
    $ cd $HOME
    $ svn co http://svn.lmd.jussieu.fr/LMDZ_WRF/trunk/tools PyNCplot
  20. Now all the scripts are held in ${HOME}/PyNCplot. It might be desirable to set an environment variable to make life easier:
    $ export pyHOME=${HOME}/PyNCplot
  21. Finally one need to compile the Fortran modules using the same python to run the scripts. This is done using a standard `Makefile' and the tool f2py to link Fortran compiled codes to python. There are different versions for: different CIMA's machines, different LMD/IPSL and French HPC machines. For a standard linux 64-bits machine (debain 9 with gcc compilers) there is one example as `Makefile.llamp'. Take one and specify a series of different variables specifically for the given machine
    FC = gfortran # Fortran compiler
    F2PY = /usr/bin/f2py # Path to the f2py tool
    F2PYF = # Fortran compiler (when system's one is not used)
    NCLIBFOLD = /usr/lib/x86_64-linux-gnu # Path to netcdf libraries
    NCINCFOLD = /usr/include # Path to netcdf includes
    NCLIBFFOLD = /usr/lib/x86_64-linux-gnu # Path to netcdf-fortran interface libraries
    NCINCFFOLD = /usr/include # Path to netcdf-fortran interface includes
  22. NOTE: One will not be able to compile all the set of programs within an anaconda environment due to problems with anaconda. Installation of netcdf4 colides with installed libnetcdff. When installing it:
  23. $ conda install netcdf4
    (...)
    - netcdf4
    The following packages will be downloaded:

    package | build
    ---------------------------|-----------------
    libnetcdf-4.6.1 | h10edf3e_2 1.3 MB

    The following NEW packages will be INSTALLED:

    netcdf4: 1.4.2-py27h4b4f87f_0

    The following packages will be REMOVED:

    libnetcdff: 4.4.4-0 matthewharrison

    The following packages will be UPDATED:

    libnetcdf: 4.4.0-hf6ef953_0 matthewharrison --> 4.6.1-h10edf3e_2
  24. Because of that, Makefile is split in two compilation sub-sets
    $ make pymods: compilation of Fortran modules used in the python scripts
    $ make NCfortran: compiation of Fortran modules and main programs which require
    netCDF-fortran interface: (for: DistriCorrection and trajectories_overlap)
    $ make: compiles all components
  25. Then one only needs to link the Makefile and compile
  26. $ ln -s Makefile.[machine].[compiler] ./Makefile
    $ make [OptionalFlags] >& run_make.log
  27. At the end one should have: