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
    

Installing Miniforge

  • CMOR 3.9.0 on conda-forge has support for Python 3.9, 3.10, 3.11, and 3.12.

  • Download the Miniforge installer for your system.
    • CMOR is currently only supported for Linux and macOS x86_64, and macOS arm64 (Apple Silicon)
  • Start the install with the following command

    bash Miniforge3-$(uname)-$(uname -m).sh
    

Creating the mamba environement with compilers and needed libraries

  • Depending on your os mamba 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

    mamba 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 mamba environment

    mamba 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