clim-recal installation
clim-recal is a set of tools to manage UK climate data and projections, and running a range of correction methods in python and R. For ease of installation and use, we focus primarily on the python portion, but in principal the R notebooks should be useable via RStudio, which suggests packages necessary to install. We also provide docker configurations which include both R and python environments.
1 Quickstart
There are several different ways to install clim-recal . We have used docker the most across different platforms
For users who already have conda (or mamba) installed:
git clone https://github.com/alan-turing-institute/clim-recal
cd clim-recal
pip install conda-lock
conda-lock install --name clim-recal conda-lock.yml
conda activate clim-recal
cd python
pdm install
clim-recal --helpFor docker:
git clone https://github.com/alan-turing-institute/clim-recal
cd clim-recal
docker compose build jupyter
docker compose up jupyter
clim-recal --helpThere are cases where pdm install raises a KeyError: '_PYPROJECT_HOOKS_BUILD_BACKEND'. Thus far, running pdm install again works.
2 Options
Once installed the clim-recal command can be run with files. The settings below are specific to a server
clim-recal --help
Usage: clim-recal [OPTIONS]
Crop and align UK climate projections and test debias methods.
╭─ Options ──────────────────────────────────────────────────────────────╮
│ --hads-input-path -d PATH [default: .] │
│ --cpm-input-path -o PATH [default: .] │
│ --output-path -o DIRECTORY [default: │
│ clim-recal-runs] │
│ --variable -v [tasmax|rainfall|t [default: tasmax] │
│ asmin] │
│ --region -a [Glasgow|Mancheste [default: │
│ r|London|Scotland] Manchester] │
│ --run -r [01|04|05|06|07|08 [default: 05] │
│ |09|10|11|12|13|14 │
│ |15] │
│ --method -m [quantile_delta_ma [default: │
│ pping|quantile_map quantile_delta_mapp… │
│ ping|variance_scal │
│ ing|delta_method] │
│ --all-variables │
│ --all-regions │
│ --all-runs │
│ --default-runs │
│ --all-methods │
│ --project-cpm [default: True] │
│ --project-hads [default: True] │
│ --crop-cpm [default: True] │
│ --crop-hads [default: True] │
│ --execute │
│ --start-index -s INTEGER RANGE [default: 0] │
│ [x>=0] │
│ --total-from-index -t INTEGER RANGE [default: 0] │
│ [x>=0] │
│ --cpus INTEGER RANGE [default: 2] │
│ [1<=x<=10] │
│ --use-multiprocessi… │
│ --install-completion Install completion │
│ for the current │
│ shell. │
│ --show-completion Show completion for │
│ the current shell, │
│ to copy it or │
│ customize the │
│ installation. │
│ --help Show this message │
│ and exit. │
╰────────────────────────────────────────────────────────────────────────╯3 Conda/Mamba Python
3.1 Conda / Mamba
More detailed examples using conda or mamba are below. Installation instructions for either these are available:
conda: https://conda.io/projects/conda/en/latest/user-guide/install/index.htmlmamba: https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html
These options are primarily to ease use of GDAL and optionally rsync.
3.2 conda-lock
conda-lock provides a means of managing dependencies for conda/mamba environments on precise, reproducible levels, and can incorporated local pyproject.toml configurations.
There are many ways to install conda-lock (for most up to date options see README.md):
pipx install conda-lockpip install conda-lockconda install --channel=conda-forge --name=base conda-lockmamba install --channel=conda-forge --name=base conda-lockOnce conda-lock is installed, clim-recal can be installed via
cd `clim-recal`
conda-lock install conda-lock.ymlcd `clim-recal`
conda-lock install conda-lock.ymlcd `clim-recal`
conda activate base
conda-lock install conda-lock.ymlcd `clim-recal`
mamba activate base
conda-lock install conda-lock.yml4 Docker
It can take some time to build, but the following will build 3 docker volumes for
jupyter: apythonenvironmentRServer: anRenvironmentquarto: documentation
cd clim-recal
docker compose buildcd clim-recal # for python
docker compose build jupytercd clim-recal # for R
docker compose build rstudiocd clim-recal # for documentation in quarto via R
docker compose build quartoOnce built, the environments built can be run via
docker compose updocker compose jupyter updocker compose rstudio updocker compose quarto up