Obtaining the CMOR and PrePARE source code and CMIP6 tables

  • Clone the repo from gituhb
    git clone git://github.com/pcmdi/cmor
    cd cmor
    git submodule init
    git submodule update

Anaconda System Requirements (if building using anaconda compilers)

Getting Anaconda

  • Anaconda
  • Make sure anaconda is in your PATH (assuming ananconda is installed in ${HOME}/anaconda)

    export PATH=${HOME}/anaconda/bin:${PATH} # for [ba]sh

Bypassing firewalls

  • If your institution has a firewall

    conda config --set ssl_verify False

Creating the conda environement with compilers and needed libraries

  • Depending on your os conda brings different compilers

    For Linux

    export CONDA_COMPILERS="gcc_linux-64 gfortran_linux-64"

    For Mac

    export CONDA_COMPILERS="clang_osx-64 gfortran_osx-64"
  • Run the following command to build CMOR for your version of Python

    For Python 3.9

    conda create -q -n cmor_dev -c conda-forge -c cdat/label/nightly -c cdat six libuuid json-c udunits2 hdf5 libnetcdf openblas netcdf4 numpy openssl lazy-object-proxy cdms2 python=3.9 $CONDA_COMPILERS testsrunner
  • Activate the conda environment

    source activate cmor_dev

Configuring cmor

  • Depending on your OS linking environment variables are different

    For Linux

    export LDSHARED_FLAGS="-shared -pthread"

    For Mac

    export LDSHARED_FLAGS=" -bundle -undefined dynamic_lookup"
  • Set the PREFIX

    Since your environment can use a different name and its location is system dependent use:

    export PREFIX=$(python -c "import sys; print(sys.prefix)")
  • configure cmor:

    ./configure --prefix=$PREFIX --with-python --with-uuid=$PREFIX --with-json-c=$PREFIX --with-udunits2=$PREFIX --with-netcdf=$PREFIX  --enable-verbose-test

Building and installing CMOR and PrePARE

  • Run

    make install

Testing the installation

Two sets of test can be used

  • C and Fortran tests
       make test
  • Python tests
       export PYTHONPATH=Test
       python run_tests.py -v2 -H -n1 Test/test_python_CMIP6_CV*.py
Tags: github