Skip to content

Commit 8c26336

Browse files
authored
Merge pull request #312 from Climate-REF/fix-integration
2 parents badb7fc + 218a1e2 commit 8c26336

File tree

19 files changed

+342
-174
lines changed

19 files changed

+342
-174
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ jobs:
7070
python-version: ${{ matrix.python-version }}
7171
- name: Check importable without extras
7272
run: |
73-
uv run --package climate_ref scripts/test-install.py climate_ref
74-
uv run --package climate_ref_core scripts/test-install.py climate_ref_core
75-
uv run --package climate_ref_celery scripts/test-install.py climate_ref_celery
76-
uv run --package climate_ref_ilamb scripts/test-install.py climate_ref_ilamb
77-
uv run --package climate_ref_esmvaltool scripts/test-install.py climate_ref_esmvaltool
78-
uv run --package climate_ref_pmp python scripts/test-install.py climate_ref_pmp
73+
uv run --isolated --with-editable packages/climate-ref --with typer --no-project scripts/test-install.py climate_ref
74+
uv run --isolated --with-editable packages/climate-ref-core --with typer --no-project scripts/test-install.py climate_ref_core
75+
uv run --isolated --with-editable packages/climate-ref-celery --with typer --no-project scripts/test-install.py climate_ref_celery
76+
uv run --isolated --with-editable packages/climate-ref-ilamb --with typer --no-project scripts/test-install.py climate_ref_ilamb
77+
uv run --isolated --with-editable packages/climate-ref-esmvaltool --with typer --no-project scripts/test-install.py climate_ref_esmvaltool
78+
uv run --isolated --with-editable packages/climate-ref-pmp --with typer --no-project scripts/test-install.py climate_ref_pmp
7979
8080
check-build:
8181
runs-on: ubuntu-latest

.github/workflows/install-pypi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ jobs:
6161
uses: actions/checkout@v4
6262
with:
6363
ref: ${{ env.INSTALLED_VERSION }}
64+
# Windows can't clone the entire directory due to filename length
65+
sparse-checkout: |
66+
scripts
6467
- name: Test installation
6568
run: |
6669
which python
@@ -112,6 +115,8 @@ jobs:
112115
uses: actions/checkout@v4
113116
with:
114117
ref: ${{ env.INSTALLED_VERSION }}
118+
sparse-checkout: |
119+
scripts
115120
- name: Test installation
116121
run: |
117122
which python

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ fetch-test-data: ## Download any data needed by the test suite
172172

173173
.PHONY: fetch-ref-data
174174
fetch-ref-data: ## Download reference data needed by providers and (temporarily) not in obs4mips
175+
uv run ref datasets fetch-data --registry esmvaltool
175176
uv run ref datasets fetch-data --registry ilamb
176177
uv run ref datasets fetch-data --registry iomb
177178

changelog/312.docs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated documentation to include more information about concepts within the REF.

docs/development.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ make virtual-environment
3434
mkdir $PWD/.ref
3535
uv run ref config list > $PWD/.ref/ref.toml
3636
export REF_CONFIGURATION=$PWD/.ref
37-
38-
# Download some test data and ingest the sample datasets.
39-
make fetch-test-data
40-
uv run ref datasets ingest --source-type cmip6 $PWD/tests/test-data/sample-data/CMIP6/
41-
uv run ref datasets ingest --source-type obs4mips $PWD/tests/test-data/sample-data/obs4MIPs/
4237
```
4338

4439
`uv` will create a virtual Python environment in the directory `.venv` containing
@@ -55,17 +50,46 @@ If there are any issues, the messages from the `Makefile` should guide you
5550
through. If not, please raise an issue in the
5651
[issue tracker](https://github.com/Climate-REF/climate-ref/issues).
5752

58-
### Running your first `solve`
53+
### Ingesting datasets
5954

60-
If you want to run the sample data through the whole pipeline, you need to download
61-
reference data, but note that the reference data is several Gigabytes in size.
55+
The REF requires datasets, both reference and model, to be ingested into the database.
56+
These ingested datasets are then used to solve for what executions are available and require running.
6257

63-
```shell
64-
# Download reference data which is not (yet) included in obs4mips
65-
make fetch-ref-data
58+
We have a consistent set of decimated sample data that is used for testing.
59+
These can be ingested using the following command:
60+
61+
```bash
62+
make fetch-test-data
63+
uv run ref datasets ingest --source-type cmip6 $PWD/tests/test-data/sample-data/CMIP6/
64+
uv run ref datasets ingest --source-type obs4mips $PWD/tests/test-data/sample-data/obs4REF/
65+
```
66+
67+
Additional reference datasets can be fetched by following the instructions [here](introduction/required_datasets.md).
68+
The Obs4REF step is not required as we have already ingested these datasets above.
69+
70+
### Creating provider environments
71+
72+
The REF uses a number of different providers to run the diagnostics.
73+
Some of these providers may require an additional conda environment to be created before running.
74+
75+
```bash
76+
uv run ref providers create-env
77+
```
78+
79+
The created environments and their locations can be viewed using the command:
80+
81+
```bash
82+
uv run ref providers list
6683
```
6784

68-
After that, you can let the REF calculate all included metrics for the sample data.
85+
### Running your first `solve`
86+
87+
Once you have ingested some sample data and created any required environments,
88+
you can run your first `solve` command.
89+
90+
A `solve` will take the ingested datasets and the providers declared in the configuration, and determine
91+
which new executions are required.
92+
6993
Note that this will take a while to run.
7094

7195
```shell
@@ -74,7 +98,8 @@ uv run ref solve
7498

7599
Afterwards, you can check the output of `uv run ref executions list-groups` to see if metrics
76100
were evaluated successfully, and if they were, you find the results in the
77-
`.ref/results` folder. Don't worry too much if some executions are failing for you,
101+
`$PWD/.ref/results` folder.
102+
Don't worry too much if some executions are failing for you,
78103
things are still in active development at the moment.
79104

80105
### Pip editable installation
@@ -104,14 +129,17 @@ Some metric providers can use their own conda environments.
104129
The REF can manage these for you,
105130
using a bundled version of [micromamba](https://github.com/mamba-org/micromamba-releases).
106131

107-
A new environment for a metric provider can be created with the following command:
132+
The conda environments for the registered providers can be created with the following command:
108133

109134
```bash
110-
ref --log-level=info providers create-env --provider esmvaltool
135+
ref --log-level=info providers create-env
111136
```
112137

113138
A new environment will be created automatically for each conda-based metric provider when it is first used,
114139
if one does not already exist.
140+
This can cause issues if the environment is created on a node that doesn't have internet access,
141+
or if a race condition occurs when multiple processes try to create the environment at the same time.
142+
115143

116144
/// admonition | Note
117145

docs/hackathon.md

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -45,66 +45,11 @@ The metrics that are currently available in the REF are relatively limited so no
4545
It is recommended to read through the [developer documentation](development.md) to get an understanding of the REF and how we collaborate.
4646

4747
For those interested in learning more about the REF,
48-
we recommend reading the [Architecture design document](background/architecture.md).
48+
we recommend reading the [Introduction section](introduction/index.md) [Architecture design document](background/architecture.md).
4949
This outlines the design of the REF and provides some background about the project.
5050

51-
## Brief technical overview of the REF
5251

53-
The REF is a Python package that provides a framework for running benchmarking climate models. It is designed to be flexible and extensible, allowing users to define their own metrics and ingest their own climate datasets.
54-
55-
The REF consists of 4 main steps, which are shown in the diagram below:
56-
57-
```mermaid
58-
flowchart LR
59-
Ingest --> Solve
60-
Solve --> Execute
61-
Execute --> Visualise
62-
```
63-
64-
* **Ingest** Ingesting datasets that can be used for analysis into a local database. This includes support for CMIP6, Obs4MIPs, and other observational datasets.
65-
* **Solve** Using the ingested datasets and the data requirements from the metrics, the REF determines which metrics need to be executed.
66-
* **Execute** The metrics are executed and the results collated. We support multiple different ways of running metrics that may be useful for different use cases.
67-
* **Visualise** The results of the metrics are visualised. This can be in the form of plots, tables, or other outputs.
68-
69-
### Diagnostics
70-
At the core of the REF is the [Diagnostic][climate_ref_core.diagnostics.Diagnostic] protocol.
71-
This protocol defines the common interface that all metrics must implement.
72-
A diagnostic defines the different datasets that a metric requires (see [dataset-selection](how-to-guides/dataset-selection.py)), and how to calculate a number of metric value from them.
73-
These metric values can be either scalar or timeseries data.
74-
How a metric is actually calculated depends on which metrics provider the metric comes from.
75-
76-
The rest of the complexity that comes from figuring out which datasets to use, how to run the diagnostic, and how to visualise the results is handled by the REF.
77-
78-
### Diagnostic Providers
79-
Diagnostics are grouped into packages, one for each of the diagnostic providers selected for the CMIP7 AFT.
80-
These diagnostic packages (ESMValTool, ILAMB and PMP) each have different ways of calculating diagnostics.
81-
82-
For some diagnostic providers (ILAMB and ESMValTool),
83-
an additional conda environment will be required
84-
to run the metrics locally.
85-
This is still a work in progress ([#117](https://github.com/Climate-REF/climate-ref/pull/117))
86-
and is expected to be available to use by the time of the hackathon.
87-
88-
### Ouput
89-
90-
The output of a diagnostic execution can be a range of different outcomes:
91-
92-
* Scalar values
93-
* Timeseries
94-
* Plots
95-
* Tables
96-
* HTML reports
97-
98-
To support the capture of these different outputs in a standardised way,
99-
the REF uses the [Earth System Metrics and Diagnostics Standards (EMDS)](https://github.com/Earth-System-Diagnostics-Standards/EMDS).
100-
A REF-specific extension to this format will be developed as
101-
part of this process.
102-
103-
These outputs will be ingested into a database
104-
and made available through an API/web interface or CLI tool.
105-
This is still early work so input into how we can expose the results in a meaningful way is welcome.
106-
107-
### Compute Engine
52+
## Deployment environments
10853

10954
The REF is designed to be run on a local machine,
11055
but we are also working on support for running the REF on cloud-based systems and HPC systems.

docs/installation.md

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Each of these provider-specific environments are decoupled to allow for potentia
1111
This uses a bundled version of the [micromamba](https://github.com/mamba-org/micromamba-releases)
1212
to create and manage the environment so no additional dependencies are required.
1313

14-
## PyPI
14+
## Installing `climate-ref`
15+
### PyPI
1516

1617
You can install `climate-ref` using `pip`:
1718

@@ -42,7 +43,7 @@ The actual execution occurs within a provider-specific conda environment.
4243

4344

4445

45-
## Conda
46+
### Conda
4647

4748
/// admonition | conda-forge
4849
type: warning
@@ -62,7 +63,7 @@ A modern alternative to using `conda` as package a manager is [Pixi](https://pix
6263
Pixi uses the same packages as `conda` but is faster and can create reproducible environments out of the box.
6364

6465

65-
## Docker
66+
### Docker
6667

6768
For production use, we recommend using the `climate-ref` Docker image to provide a consistent environment for running the REF.
6869
Not all users may support docker directly, instead requiring the use of [Apptainer](https://apptainer.org/docs/user/latest/) to provide some additional isolation.
@@ -93,7 +94,7 @@ bash scripts/initialise-docker.sh
9394
docker-compose up
9495
```
9596

96-
## From Source
97+
### From Source
9798

9899
To install `climate-ref` from the source code, clone the repository and install it:
99100

@@ -104,3 +105,50 @@ make virtual-environment
104105
```
105106

106107
See the [development documentation](development.md) for more information on how to contribute to the project.
108+
109+
110+
## Installing metric provider dependencies
111+
112+
/// admonition | Windows support
113+
type: warning
114+
115+
Window's doesn't support some of the packages required by the metrics providers,
116+
so we only support MacOS and Linux.
117+
Windows users are recommended to use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)
118+
or a Linux VM if they wish to use the REF.
119+
120+
///
121+
122+
Some metric providers can use their own conda environments.
123+
The REF can manage these for you,
124+
using a bundled version of [micromamba](https://github.com/mamba-org/micromamba-releases).
125+
126+
The conda environments for the registered providers can be created with the following command:
127+
128+
```bash
129+
ref --log-level=info providers create-env
130+
```
131+
132+
A new environment will be created automatically for each conda-based metric provider when it is first used,
133+
if one does not already exist.
134+
This can cause issues if the environment is created on a node that doesn't have internet access,
135+
or if a race condition occurs when multiple processes try to create the environment at the same time.
136+
137+
138+
/// admonition | Note
139+
140+
The PMP conda environment is not yet available for arm-based MacOS users,
141+
so the automatic installation process will fail.
142+
143+
Arm-based MacOS users can use the following command to create the conda environment manually:
144+
145+
```bash
146+
MAMBA_PLATFORM=osx-64 uv run ref providers create-env --provider pmp
147+
```
148+
149+
///
150+
151+
The created environments and their locations can be viewed using the command:
152+
153+
```bash
154+
uv run ref providers list

0 commit comments

Comments
 (0)