title |
---|
`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.
::: {.callout-note}
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 --help
For docker
:
git clone https://github.com/alan-turing-institute/clim-recal
cd clim-recal
docker compose build jupyter
docker compose up jupyter
clim-recal --help
::: {.callout-warning}
There are cases where pdm install
raises a
KeyError: '_PYPROJECT_HOOKS_BUILD_BACKEND'
. Thus far, running pdm install
again works.
:::
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. │
╰────────────────────────────────────────────────────────────────────────╯
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
.
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
):
::: {.panel-tabset}
pipx install conda-lock
pip install conda-lock
conda install --channel=conda-forge --name=base conda-lock
mamba install --channel=conda-forge --name=base conda-lock
:::
Once conda-lock
is installed, clim-recal
can be installed via
::: {.panel-tabset}
cd `clim-recal`
conda-lock install conda-lock.yml
cd `clim-recal`
conda-lock install conda-lock.yml
cd `clim-recal`
conda activate base
conda-lock install conda-lock.yml
cd `clim-recal`
mamba activate base
conda-lock install conda-lock.yml
:::
It can take some time to build, but the following will build 3 docker
volumes
for
jupyter
: apython
environmentRServer
: anR
environmentquarto
: documentation
::: {.panel-tabset}
cd clim-recal
docker compose build
cd clim-recal # for python
docker compose build jupyter
cd clim-recal # for R
docker compose build rstudio
cd clim-recal # for documentation in quarto via R
docker compose build quarto
:::
Once built, the environments built can be run via
::: {.panel-tabset}
docker compose up
docker compose jupyter up
docker compose rstudio up
docker compose quarto up
:::