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
    

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

    Python 3.11

    conda create -n cmor_dev -c conda-forge six libuuid json-c udunits2 hdf5 libnetcdf openblas netcdf4 numpy openssl python=3.11 $CONDA_COMPILERS
    
  • Activate the conda environment

    conda 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

  • Run C, Fortran, and Python tests
    make test
    
Tags: github