Obtaining the sources

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

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 2.7

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

    For Python 3.7

    conda create -q -n cmor_dev -c cdat/label/nightly -c conda-forge -c cdat six libuuid json-c udunits2 hdf5 libnetcdf netcdf4 numpy openssl lazy-object-proxy cdms2 python=3.7 $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 CMOR

  • 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