EQC Quality Assessment: "Near-future CORDEX projections of the SPEI6 drought index over the Mediterranean region"
Dataset: projections-cordex-domains-single-levels [CDS]
Aspect: validation_q08  |  Category: Climate_Projections
Section: Near-future CORDEX projections of the SPEI6 drought index over the Mediterranean region > ℹ If you want to know more > References
---
ani, Z. A., 1985. Reference crop evapotranspiration from temperature, Applied engineering in agriculture, pp. 96–99.  https://doi.org/10.13031/2013.26773

[[8]](https://doi.org/10.1002/joc.3887) Beguerı́a, S., Vicente-Serrano, S. M., Reig, F., and Latorre, B., 2014. Standardized precipitation evapotranspiration index (spei) revisited: Parameter fitting, evapotranspiration models, tools, datasets and drought monitoring, International Journal of Climatology, 34, 3001–3023. https://doi.org/10.1002/joc.3887


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study
---
Production date: 2025-09-30.

Dataset version: 2.0.

Produced by: Olivier Burggraaff, Nicole Reynolds (National Physical Laboratory).


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Quality assessment question
---
* **Are the climate indicators in the dataset underpinning the Copernicus Interactive Climate Atlas consistent with their origin datasets?**
* **Can the dataset underpinning the Copernicus Interactive Climate Atlas be reproduced from its origin datasets?**

The [_Copernicus Interactive Climate Atlas_](https://atlas.climate.copernicus.eu/atlas), or _C3S Atlas_ for short, is a C3S web application providing an easy-to-access tool for exploring climate projections, reanalyses, and observational data [[Gutiérrez+24](https://doi.org/10.21957/ah52ufc369)].
Version 2.0 of the application allows the user to interact with 12 datasets:

| Type               | Dataset       |
|--------------------|---------------|
| Climate Projection | CMIP6         |
| Climate Projection | CMIP5         |
| Climate Projection | CORDEX-CORE   |
| Climate Projection | CORDEX-EUR-11 |
| Reanalysis         | ERA5          |
| Reanalysis         | ERA5-Land     |
| Reanalysis         | ORAS5         |
| Reanalysis         | CERRA         |
| Observations       | E-OBS         |
| Observations       | BERKEARTH     |
| Observations       | CPC           |
| Observations       | SST-CCI       |

These datasets are provided through an intermediary dataset, the [_Gridded dataset underpinning the Copernicus Interactive Climate Atlas_](https://doi.org/10.24381/cds.h35hb680) or _C3S Atlas dataset_ for short [[C3S Atlas dataset](https://doi.org/10.24381/cds.h35hb680)].
Compared to their origins, the versions of the climate datasets within the C3S Atlas dataset have been processed following the workflow in Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q01_workflow-fig>`.

attachment:c3s_atlas_dataset_workflow.png
---
height: 360px
name: multi-origin-c3s-atlas_consistency_q01_workflow-fig
---
Schematic representation of the workflow for the production of the C3S Atlas dataset from its origin datasets, from the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/chapter01.html).
```

Because a wide range of users interact with climate data through the C3S Atlas application, it is crucial that the underpinning dataset represent its origins correctly.
In other words, the C3S Atlas dataset must be consistent with and reproducible from its origins.
Here, we assess this consistency and reproducibility by comparing climate indicators retrieved from the C3S Atlas dataset with their equivalents calculated from the origin dataset, mirroring the workflow from Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q01_workflow-fig>`.
While a full analysis and reproduction of every record within the C3S Atlas dataset is outside the scope of quality assessment
(and would require high-performance computing infrastructure),
a case study with a narrower scope probes these quality attributes of the dataset
and can be a jumping-off point for further analysis by the reader.

This notebook is part of a series:
| Notebook | Contents |
|---|---|
| **Consistency between the C3S Atlas dataset and its origins: Case study** | Comparison between C3S Atlas dataset and one origin dataset (CMIP6) for one indicator (`tx35`), including detailed setup. |
| [](./derived_multi-origin-c3s-atlas_consistency_q02) | Comparison between C3S Atlas dataset and one origin dataset (CMIP6) for multiple indicators. |
| [](./derived_multi-origin-c3s-atlas_consistency_q03) | Comparison between C3S Atlas dataset and multiple origin datasets for one indicator. |


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Quality assessment statement
---
These are the key outcomes of this assessment

* Climate indicators (here `tx35`) provided by the C3S Atlas dataset are highly consistent with values calculated from its origin datasets (here the CMIP6 multi-model ensemble).

* Differences between the C3S Atlas dataset and a manual reproduction are rare (fewer than 0.1% of pixel pairs) and generally negligible (median absolute difference of 0).

* The C3S Atlas is traceable and reproducible, and can be confidently used to view, analyse, and download climate data.
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Methodology
---
This quality assessment tests the consistency between climate indicators retrieved from the [_Gridded dataset underpinning the Copernicus Interactive Climate Atlas_](https://doi.org/10.24381/cds.h35hb680) [[C3S Atlas dataset](https://doi.org/10.24381/cds.h35hb680)] and their equivalents calculated from the origin datasets,
as well as the reproducibility of said dataset.

This notebook starts the quality assessment with a simple case study: one climate indicator derived from one origin dataset.
This indicator is `tx35`,
the _Monthly count of days with maximum near-surface (2-metre) air temperature above 35 °C_,
derived from the CMIP6 multi-model ensemble [[CMIP6 dataset](https://doi.org/10.24381/cds.c866074c)].
This notebook mirrors [one of the reproducibility demonstrations](https://ecmwf-projects.github.io/c3s-atlas/notebooks/tx35.html) written by the data provider.

The analysis and results are organised in the following steps, which are detailed in the sections below:

**[](section-codesetup)**
 * Install User-tools for the C3S Atlas.
 * Import all required libraries.
 * Define indicator.
 * Define helper functions.

**[](section-origin)**
 * Download data from the origin dataset.
 * Homogenise data.
 * Calculate indicator.
 * Regrid the origin data to the C3S Atlas grid.

**[](section-c3s-atlas)**
 * Download data from the C3S Atlas dataset.

**[](section-results)**
 * Consistency: Compare the C3S Atlas and reproduced datasets on native grids.
 * Reproducibility: Compare the C3S Atlas and reproduced datasets on the C3S Atlas grid.


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 1. Code setup
---
This notebook uses [earthkit](https://github.com/ecmwf/earthkit) for
downloading ([earthkit-data](https://github.com/ecmwf/earthkit-data))
and visualising ([earthkit-plots](https://github.com/ecmwf/earthkit-plots)) data.
Because earthkit is in active development, some functionality may change after this notebook is published.
If any part of the code stops functioning, please raise an issue on our GitHub repository so it can be fixed.
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 1. Code setup > Install the User-tools for the C3S Atlas
---
This notebook uses the [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas), which can be installed from GitHub using `pip`.
For convenience, the following cell can do this from within the notebook.
Further details and alternative options for installing this library are available in its [documentation](https://github.com/ecmwf-projects/c3s-atlas?tab=readme-ov-file#requirements).


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 1. Code setup > Import required libraries
---
In this section, we import all the relevant packages needed for running the notebook.

Input / Output
General data handling
Data pre-processing
Climate indicators
Visualisation
Visualisation in Jupyter book -- automatically ignored otherwise


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 1. Code setup > Define indicators
---
This section defines functions and variables for calculating and using the climate indicators:

Functions to calculate indicators

The following cell defines [earthkit-plots styles](https://earthkit-plots.readthedocs.io/en/latest/examples/examples/introduction/05-styles.html) for the indicators.
These styles define the colour maps and colour bar ranges for each quantity.

Styles for indicators
Apply general settings


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 1. Code setup > Helper functions
---
This section defines some functions and variables used in the following analysis, allowing code cells in later sections to be shorter and ensuring consistency.

##### Data (pre-)processing

The following functions handle the homogenisation of origin data to a consistent format using the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/intro.html):

Homogenisation of origin dataset
Homogenisation of origin dataset, multiple non-consecutive years

The following functions handle regridding data based on ESMF as implemented in the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/intro.html).
This step is explained in more detail in the relevant section below.

Regridding from native grid to C3S Atlas grid

The following functions aid in sub-selecting data, e.g. selecting one model from the ensemble included in the C3S Atlas dataset or selecting data for a specific time frame:

C3S Atlas dataset: Individual model selection
Ensure the model ID is provided in the right format
Find the corresponding model ID in the list of models
This cannot use .sel because the coordinate is not indexed
Find the corresponding data and return those
Select (multiple) years in a dataset
Select one month in multiple datasets

##### Statistics
The following functions calculate the difference (absolute / relative) between datasets, handling metadata etc.:

Difference between datasets
Select and calculate
Replace 0/0 with 0

The following functions calculate and display metrics for the difference between two datasets, e.g. mean and median deviation:

Calculate differences
Convert to pandas
In this notebook: Group by year first
Calculate aggregate statistics
Calculate correlation coefficients
Combine statistics into one dataframe

##### Visualisation
The following cells contain functions for plotting results, starting with some base helper functions (e.g. displaying in Jupyter Notebook or Jupyter Book style, adding textboxes with consistent formatting, etc.):

Visualisation: Helper functions, general
Get the plt.Axes for each ekp.Subplot
Set up location
Add the text

The following functions are also base helper functions, but specific to geospatial plots:

Visualisation: Helper functions for geospatial plots
Create subplots
Remove redundant time coordinate

The following cell contains functions for geospatial comparisons between datasets on their native grids or on a common grid (the latter also showing the per-pixel difference):

Visualisation: Plot indicators geospatially
Pre-process: Select data in one month, group by year
Create figure
Plot indicators
Plot individual datasets
Decorate: Text + Colour bar
Titles on top
Decorate figure
Visualisation: Plot indicator + difference geospatially
Pre-process: Select data in one month, group by year
Create figure
Plot indicators
Plot individual datasets
Plot difference
Colour bar at the bottom
Titles on top
Decorate figure

The following cell contains functions for histogram comparisons between datasets on their native grids or on a common grid (the latter also showing the per-pixel difference):

Visualisation: Plot data in histograms
Group data by year
Create figure
Plot histograms of data
Loop over rows / indicators
Loop over columns / data
Flatten data
Create histogram
Identify panel
Titles on top
Visualisation: Plot data + difference in histograms
Group data by year
Create figure
Setup x/y share -- cannot be done in plt.subplots because of difference panel not sharing these
Plot histograms of data
Loop over rows / indicators
Calculate difference
Loop over columns / data
Flatten data
Create histogram
Plot difference
Identify panel
Titles on top
Decorate figure

(section-origin)=


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Download data
---
This assessment examines the dataset in two years (2060 and 2080),
for one ensemble member
and
for one climate scenario
– which is not how climate projection data are normally used.
Good practice in climate science is to look at multi-year statistics and trends,
across multiple ensemble members.
However, since the purpose of this assessment is to assess the consistency and reproducibility of the post-processing performed to produce the C3S Atlas dataset,
it is valid to use a subset of the data here.
The specific subset used can be easily tweaked by changing the `EXPERIMENT`, `MODEL`, and `YEARS` variables in this section.

This notebook uses [earthkit-data](https://github.com/ecmwf/earthkit-data) to download files from the CDS.
If you intend to run this notebook multiple times, it is highly recommended that you [enable caching](https://earthkit-data.readthedocs.io/en/latest/concepts/caching.html) to prevent having to download the same files multiple times.
If you prefer not to use earthkit, the following requests can also be used with the [cdsapi module](https://cds.climate.copernicus.eu/how-to-api#linux-use-client-step).
In either case (earthkit-data or cdsapi), it is required to set up a CDS account and API key as explained [on the CDS website](https://cds.climate.copernicus.eu/how-to-api).

The first step is to define the parameters that will be shared between the download of the origin dataset (here CMIP6) and the C3S Atlas dataset (in the [next section](section-c3s-atlas)), namely the experiment and model member.
Next, the request to download the corresponding data from CMIP6 is defined,
in this notebook choosing only the variable necessary to calculate the `tx35` indicator, namely `daily_maximum_near_surface_air_temperature`.
Because the indicator will be calculated for multiple years, the `year` parameter of the request is left out for now.

Define request

This case study examines
two years, namely 2060 and 2080, so there are two
corresponding requests.
This can easily be changed or extended to use different years.
Separate requests are defined for each year,
rather than one combined request,
to limit the size per request.

Download data

Earthkit downloads the data as a field list.
This is converted into an `xarray` dataset, which can be used in the following analysis.


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Download data
---
as a field list.
This is converted into an `xarray` dataset, which can be used in the following analysis.

```text
<xarray.Dataset> Size: 167MB
Dimensions:    (time: 730, bnds: 2, lat: 192, lon: 288)
Coordinates:
  * time       (time) object 6kB 2060-01-01 12:00:00 ... 2080-12-31 12:00:00
  * lat        (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon        (lon) float64 2kB 0.0 1.25 2.5 3.75 ... 355.0 356.2 357.5 358.8
    height     float64 8B 2.0
Dimensions without coordinates: bnds
Data variables:
    time_bnds  (time, bnds) object 12kB dask.array<chunksize=(1, 2), meta=np.ndarray>
    lat_bnds   (time, lat, bnds) float64 2MB dask.array<chunksize=(365, 192, 2), meta=np.ndarray>
    lon_bnds   (time, lon, bnds) float64 3MB dask.array<chunksize=(365, 288, 2), meta=np.ndarray>
    tasmax     (time, lat, lon) float32 161MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
Attributes: (12/48)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60225.0
    branch_time_in_parent:  60225.0
    comment:                none
    ...                     ...
    title:                  CMCC-ESM2 output prepared for CMIP6
    variable_id:            tasmax
    variant_label:          r1i1p1f1
    license:                CMIP6 model data produced by CMCC is licensed und...
    cmor_version:           3.6.0
    tracking_id:            hdl:21.14100/a1513d6f-5325-4b99-bbe6-9b096557b100
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Homogenise data
---
One of the steps in the C3S Atlas dataset production chain is homogenisation, i.e. ensuring consistency between data from different origin datasets.
This homogenisation is implemented in the [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas/tree/main/c3s_atlas), specifically the `c3s_atlas.fixers.apply_fixers` function.
The following changes are applied:

- The names of the spatial coordinates are standardised to `[lon, lat]`.
- Longitude is converted from `[0...360]` to `[-180...180]` format.
- The time coordinate is standardised to the CF standard calendar.
- Variable units are standardised (e.g. °C for temperature).
- Variables are resampled / aggregated to the required temporal resolution.

The homogenisation is applied in the following code cell.
The `apply_fixers` function describes the different homogenisation steps as it applies them;
this can be read by expanding the following cell outputs.


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Homogenise data
---
can be read by expanding the following cell outputs.

```text
2025-09-30 20:57:27,598 — Homogenization-fixers — INFO — Dataset has already the correct names for its coordinates
2025-09-30 20:57:27,609 — Homogenization-fixers — INFO — Fixing calendar for <xarray.Dataset> Size: 84MB
Dimensions:    (time: 365, bnds: 2, lat: 192, lon: 288)
Coordinates:
  * time       (time) object 3kB 2060-01-01 12:00:00 ... 2060-12-31 12:00:00
  * lat        (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon        (lon) float64 2kB 0.0 1.25 2.5 3.75 ... 355.0 356.2 357.5 358.8
    height     float64 8B 2.0
Dimensions without coordinates: bnds
Data variables:
    time_bnds  (time, bnds) object 6kB dask.array<chunksize=(1, 2), meta=np.ndarray>
    lat_bnds   (time, lat, bnds) float64 1MB dask.array<chunksize=(365, 192, 2), meta=np.ndarray>
    lon_bnds   (time, lon, bnds) float64 2MB dask.array<chunksize=(365, 288, 2), meta=np.ndarray>
    tasmax     (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
Attributes: (12/48)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60225.0
    branch_time_in_parent:  60225.0
    comment:                none
    ...                     ...
    title:                  CMCC-ESM2 output prepared for CMIP6
    variable_id:            tasmax
    variant_label:          r1i1p1f1
    license:                CMIP6 model data produced by CMCC is licensed und...
    cmor_version:           3.6.0
    tracking_id:            hdl:21.14100/a1513d6f-5325-4b99-bbe6-9b096557b100
2025-09-30 20:57:27,877 — UNITS_TRANSFORM — INFO — The dataset tasmax units are not in the correct magnitude. A conversion from K to Celsius will be performed.
2025-09-30 20:57:27,962 — Homogenization-fixers — INFO — The dataset is in daily or monthly resolution, we don't need to resample it from hourly frequency
2025-09-30 20:57:27,999 — Homogenization-fixers — INFO — Dataset has already the correct names for its coordinates
2025-09-30 20:57:28,005 — Homogenization-fixers — INFO — Fixing calendar for <xarray.Dataset> Size: 84MB
Dimensions:    (time: 365, bnds: 2, lat: 192, lon: 288)
Coordinates:
  * time       (time) object 3kB 2080-01-01 12:00:00 ... 2080-12-31 12:00:00
  * lat        (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon        (lon) float64 2kB 0.0 1.25 2.5 3.75 ... 355.0 356.2 357.5 358.8
    height     float64 8B 2.0
Dimensions without coordinates: bnds
Data variables:
    time_bnds  (time, bnds) object 6kB dask.array<chunksize=(1, 2), meta=np.ndarray>
    lat_bnds   (time, lat, bnds) float64 1MB dask.array<chunksize=(365, 192, 2), meta=np.ndarray>
    lon_bnds   (time, lon, bnds) float64 2MB dask.array<chunksize=(


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Homogenise data
---
) float64 1MB dask.array<chunksize=(365, 192, 2), meta=np.ndarray>
    lon_bnds   (time, lon, bnds) float64 2MB dask.array<chunksize=(

365, 288, 2), meta=np.ndarray>
    tasmax     (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
Attributes: (12/48)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60225.0
    branch_time_in_parent:  60225.0
    comment:                none
    ...                     ...
    title:                  CMCC-ESM2 output prepared for CMIP6
    variable_id:            tasmax
    variant_label:          r1i1p1f1
    license:                CMIP6 model data produced by CMCC is licensed und...
    cmor_version:           3.6.0
    tracking_id:            hdl:21.14100/a1513d6f-5325-4b99-bbe6-9b096557b100
2025-09-30 20:57:28,258 — UNITS_TRANSFORM — INFO — The dataset tasmax units are not in the correct magnitude. A conversion from K to Celsius will be performed.
2025-09-30 20:57:28,384 — Homogenization-fixers — INFO — The dataset is in daily or monthly resolution, we don't need to resample it from hourly frequency
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Homogenise data
---
resolution, we don't need to resample it from hourly frequency
```

```text
<xarray.Dataset> Size: 162MB
Dimensions:  (time: 732, lat: 192, lon: 288)
Coordinates:
  * lat      (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon      (lon) float64 2kB -178.8 -177.5 -176.2 -175.0 ... 177.5 178.8 180.0
  * time     (time) datetime64[ns] 6kB 2060-01-01 2060-01-02 ... 2080-12-31
    height   float64 8B 2.0
Data variables:
    tasmax   (time, lat, lon) float32 162MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
Attributes: (12/48)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60225.0
    branch_time_in_parent:  60225.0
    comment:                none
    ...                     ...
    title:                  CMCC-ESM2 output prepared for CMIP6
    variable_id:            tasmax
    variant_label:          r1i1p1f1
    license:                CMIP6 model data produced by CMCC is licensed und...
    cmor_version:           3.6.0
    tracking_id:            hdl:21.14100/a1513d6f-5325-4b99-bbe6-9b096557b100
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Calculate indicator
---
The climate indicator,
in this notebook only `tx35`,
is calculated using [xclim](https://xclim.readthedocs.io/en/stable/).
The function `cal_tx35`, defined [above](section-codesetup), performs the calculation.
This function needs to be applied year-by-year, which is achieved using `groupby`.

```text
<xarray.Dataset> Size: 11MB
Dimensions:  (time: 24, lat: 192, lon: 288)
Coordinates:
  * lat      (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon      (lon) float64 2kB -178.8 -177.5 -176.2 -175.0 ... 177.5 178.8 180.0
    height   float64 8B 2.0
  * time     (time) datetime64[ns] 192B 2060-01-01 2060-02-01 ... 2080-12-01
Data variables:
    tx35     (time, lat, lon) int64 11MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 2. Calculate indicator from the origin dataset > Regrid to C3S Atlas grid
---
This notebook uses [xESMF](https://github.com/pangeo-data/xESMF) for regridding data.
xESMF is most easily installed using mamba/conda as explained in its documentation.
Users who cannot or do not wish to use mamba/conda can manually compile and install [ESMF](https://earthsystemmodeling.org/docs/release/latest/ESMF_usrdoc/node10.html) on their machines.
In future, this notebook will use [earthkit-regrid](https://github.com/ecmwf/earthkit-regrid) instead, once it reaches suitable maturity.
```

The final step in the processing is regridding to the standardised grid used in the C3S Atlas dataset (Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q01_workflow-fig>`).
This is performed through a custom function in the [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas/tree/main/c3s_atlas),
specifically `c3s_atlas.interpolation`.
This function is based on ESMF, as noted above.

Note that the C3S Atlas workflow calculates indicators first, then regrids.
For operations that involve averaging, like smoothing and regridding, the order of operations can affect the result, especially in areas with steep gradients [[Avila+15](https://doi.org/10.1016/j.wace.2015.06.003)].
Examples of such areas for a temperature index are coastlines and mountain ranges.
In the case of C3S Atlas, this order of operations was a conscious choice to preserve the "raw" signals,
e.g. preventing extreme temperatures from being smoothed out.
However, it can affect the indicator values and therefore must be considered when using the C3S Atlas application or dataset,
particularly when intercomparing it with another dataset.

Apply regridding function

```text
<xarray.Dataset> Size: 12MB
Dimensions:   (lon: 360, lat: 180, time: 24, bnds: 2)
Coordinates:
  * lon       (lon) float64 3kB -179.5 -178.5 -177.5 ... 177.5 178.5 179.5
  * lat       (lat) float64 1kB -89.5 -88.5 -87.5 -86.5 ... 86.5 87.5 88.5 89.5
  * time      (time) datetime64[ns] 192B 2060-01-01 2060-02-01 ... 2080-12-01
Dimensions without coordinates: bnds
Data variables:
    tx35      (time, lat, lon) int64 12MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    lon_bnds  (lon, bnds) float64 6kB -180.0 -179.0 -179.0 ... 179.0 179.0 180.0
    lat_bnds  (lat, bnds) float64 3kB -90.0 -89.0 -89.0 -88.0 ... 89.0 89.0 90.0
    crs       int64 8B 0
    height    float64 8B 2.0
```

(section-c3s-atlas)=


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 3. Retrieve indicator from the C3S Atlas dataset
---
Here, we download the same indicator as above directly from the [Gridded dataset underpinning the Copernicus Interactive Climate Atlas](https://doi.org/10.24381/cds.h35hb680) so the values can be compared.

Define request
Download data

The C3S Atlas dataset provides all years and members at the same time, so for convenience we pull out only the relevant entries:

```text
<xarray.Dataset> Size: 6MB
Dimensions:          (lat: 180, bnds: 2, lon: 360, time: 24)
Coordinates:
  * lat              (lat) float64 1kB -89.5 -88.5 -87.5 ... 87.5 88.5 89.5
  * lon              (lon) float64 3kB -179.5 -178.5 -177.5 ... 178.5 179.5
  * time             (time) datetime64[ns] 192B 2060-01-01 ... 2080-12-01
    member_id        <U45 180B dask.array<chunksize=(), meta=np.ndarray>
    gcm_institution  <U19 76B dask.array<chunksize=(), meta=np.ndarray>
    gcm_model        <U16 64B dask.array<chunksize=(), meta=np.ndarray>
    gcm_variant      <U8 32B dask.array<chunksize=(), meta=np.ndarray>
    threshold35c     float64 8B ...
    height2m         float64 8B ...
Dimensions without coordinates: bnds
Data variables:
    lat_bnds         (lat, bnds) float64 3kB dask.array<chunksize=(180, 2), meta=np.ndarray>
    lon_bnds         (lon, bnds) float64 6kB dask.array<chunksize=(360, 2), meta=np.ndarray>
    time_bnds        (time, bnds) datetime64[ns] 384B dask.array<chunksize=(24, 2), meta=np.ndarray>
    tx35             (time, lat, lon) float32 6MB dask.array<chunksize=(24, 26, 52), meta=np.ndarray>
    crs              int32 4B ...
Attributes: (12/26)
    Conventions:                CF-1.9 ACDD-1.3
    title:                      Copernicus Interactive Climate Atlas: gridded...
    summary:                    Monthly/annual gridded data from observations...
    institution:                Copernicus Climate Change Service (C3S)
    producers:                  Institute of Physics of Cantabria (IFCA, CSIC...
    license:                    CC-BY 4.0, https://creativecommons.org/licens...
    ...                         ...
    geospatial_lon_min:         -180.0
    geospatial_lon_max:         180.0
    geospatial_lon_resolution:  1.0
    geospatial_lon_units:       degrees_east
    date_created:               2024-12-05 16:37:49.749769+01:00
    tracking_id:                1a7a60e7-7787-48b5-b18f-a7bf7b4de4be
```

(section-results)=


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 4. Results
---
This section contains the comparison between the indicator values retrieved from the C3S Atlas dataset vs those reproduced from the origin dataset.

The datasets are first compared on their native grids.
This means a point-by-point comparison is not possible
(because the points are not equivalent),
but the distributions can be compared geospatially and overall.
This qualitative comparison probes the consistency quality attribute:
Are the climate indicators in the dataset underpinning the Copernicus Interactive Climate Atlas consistent with their origin datasets?

Second, the C3S Atlas dataset is compared to the indicators derived from the origin dataset and regridded to the C3S Atlas grid.
This makes a quantitative point-by-point comparison possible.
This second comparison probes how well the dataset underpinning the Copernicus Interactive Climate Atlas can be reproduced from its origin datasets,
based on the workflow (Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q01_workflow-fig>`).

For the geospatial comparison,
we display the values of the indicator for one month,
across one region and globally.
For the example of `tx35`,
June
should provide many warm days in the Northern hemisphere with significant spatial variation.

As an example, we display the results across
Europe.
This region can easily be modified in the following code cell using the [domains provided by earthkit-plots](https://earthkit-plots.readthedocs.io/en/latest/examples/examples/introduction/07-domains.html).
Some examples are provided in the cell (commented out using `#`).

Setup: Choose a month to display
Setup: Pick domain using earthkit-plots
Other examples -- uncomment where desired
domain = ekp.geo.domains.union(["Portugal", "Spain"], name="Iberia")
domain = "Italy"
domain = "South America"


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 4. Results > Consistency: Comparison on native grids
---
It is clear from
Figures {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-regional>` and {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-global>`
that the C3S Atlas dataset and its reproduction from the origin display very similar patterns,
as expected.
The general distribution of indicator values
(in both years)
is the same,
in this example showing more hot days in northern Africa, the Middle East, and eastern Europe than in western and northern Europe.
Small differences appear in various places,
likely the result of the regridding step in the C3S Atlas workflow as noted before.
Larger differences can be seen in areas with steep temperature gradients,
such as Italy with its mountains and coastlines.
Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-hist-native>`
confirms that the overall distributions in indicator values
(across all time and space dimensions)
are very similar,
but small differences exist.

For reference,
Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-export>`
displays the equivalent view
in the C3S Atlas application.
The application export is visually similar to
Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-global>`,
showing the consistency between application and dataset,
and hence showing that the conclusions from this quality assessment transfer to the C3S Atlas application.
Differences are caused by the application displaying projection data as a multi-year average
(here 2081–2100)
as well as the difference in visualisation style.

Overall, we can conclude that the C3S Atlas dataset and its origins are highly consistent,
but small differences exist due to the difference in grid.
Users of the C3S Atlas dataset
– and thus users of the C3S Atlas application –
should be aware that the indicator values retrieved for a specific location may differ slightly from a manual analysis of the origin dataset.
This effect may be larger or smaller for values aggregated over larger areas,
such as the country and IPCC-AR6 region averages available in the C3S Atlas application,
depending on the exact region and values used.

Lastly,
it should be noted that the order of operations in the C3S Atlas workflow
(regridding _after_ the indicator calculation;
Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q01_workflow-fig>`)
results in values that may differ from the opposite order of operations
(regridding _before_ indicator calculation)
[[Avila+15](https://doi.org/10.1016/j.wace.2015.06.003)].
Assessing these differences is outside the scope of this assessment.

Create plot with function defined at the start

derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-regional
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-regional"

Comparison between C3S Atlas dataset and reproduction for one indicator (`tx35`) in one month,
across Europe,
on the native grid of each dataset.
```

derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-global
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-global"

Comparison between C3S Atlas dataset and reproduction for one indicator (`tx35`) in one month,
across the globe,
on the native grid of each dataset.
```

attachment:c3s_atlas_cmip6_tx35_export.png
---
height: 600px
name: "derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-export"
---
C3S Atlas application view of `tx35` indicator in June, averaged 2081–2100 in the SSP5-8.5 scenario,
for comparison with
Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-geo-global>`
([permalink: YNZ3InLU](https://atlas.climate.copernicus.eu/atlas/YNZ3InLU)).
```
<!--
Available in the application using the following permalink:
(temporarily not working)
Include permalink when it works again
For now:
* Extreme hot days - CMIP6
* Climatology and changes -> Long term
* Scenario: SSP5-8.5
* Quantity: Climatology
* Season: June
* Drag colourbar max to 35.71
* Projection: WGS 84
* Download map as PNG
-->


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 4. Results > Consistency: Comparison on native grids
---
term
* Scenario: SSP5-8.5
* Quantity: Climatology
* Season: June
* Drag colourbar max to 35.71
* Projection: WGS 84
* Download map as PNG
-->

derived_multi-origin-c3s-atlas_consistency_q01_fig-hist-native
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q01_fig-hist-native"

Comparison between overall distributions of indicator (`tx35`) values in the C3S Atlas dataset and its reproduction,
across all spatial and temporal dimensions,
on the native grid of each dataset.
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > Analysis and results > 4. Results > Reproducibility: Comparison on C3S Atlas grid
---
After regridding to the C3S Atlas grid,
the indicator values reproduced from the origin dataset
can be compared point-by-point to the values retrieved from the C3S Atlas dataset.
We first examine some metrics that describe the difference Δ between corresponding pixels:

It is clear that the two datasets are extremely close:
the median difference and median absolute difference are both 0
and
fewer than 0.1% of pixel pairs show a non-zero difference
(defined here as |Δ| ≥ ε with ε = 10{sup}`–5` to avoid floating-point errors).
We can immediately conclude that the C3S Atlas dataset is highly reproducible
from its origins
using the provided workflow.

This conclusion is strengthened by examining the distributions of indicator values and their point-by-point differences
(Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-hist-c3s-atlas>`).
The vast majority of pixel pairs have a difference of 0,
with very few ±1 and even fewer ±2
(note the logarithmic y-axis).

However, this raises an obvious question:
why are there any differences at all?
The geospatial distribution of differences
(Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q01_fig-geocomp-regional>`)
does not appear to correlate with any patterns in the indicator values themselves nor in geography.
Since the differences are very small and seemingly random,
a potential explanation is that they simply result from small changes in
the origin dataset
and/or
the C3S Atlas workflow software
between the production of the C3S Atlas dataset and the present day.
Testing this hypothesis would require an extremely detailed analysis of all steps in the workflow,
which is outside the scope of this assessment.

Setting this question affecting <0.1% of pixels aside,
we can confidently conclude
from the metrics and figures
that the C3S Atlas dataset is highly reproducible from its origins using the provided workflow,
at least for the `tx35` indicator and CMIP6 dataset.

derived_multi-origin-c3s-atlas_consistency_q01_fig-hist-c3s-atlas
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q01_fig-hist-c3s-atlas"

Comparison between overall distributions of indicator (`tx35`) values in the C3S Atlas dataset and its reproduction
on the C3S Atlas grid,
across all spatial and temporal dimensions,
including the per-pixel difference.
```

Create plot with function defined at the start

derived_multi-origin-c3s-atlas_consistency_q01_fig-geocomp-regional
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q01_fig-geocomp-regional"

Comparison between C3S Atlas dataset and reproduction for one indicator (`tx35`) in one month,
across Europe,
on the C3S Atlas dataset grid,
including the per-pixel difference.
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > ℹ If you want to know more > Key resources
---
The CDS catalogue entries for the data used were:
* Gridded dataset underpinning the Copernicus Interactive Climate Atlas: [multi-origin-c3s-atlas](https://doi.org/10.24381/cds.h35hb680)
  * **Consistency between the C3S Atlas dataset and its origins: Case study**
  * [](./derived_multi-origin-c3s-atlas_consistency_q02)
  * [](./derived_multi-origin-c3s-atlas_consistency_q03)
* CMIP6 climate projections: [projections-cmip6](https://doi.org/10.24381/cds.c866074c)
  * [Quality assessments for CMIP6](../Climate_Projections/CMIP6/CMIP6.md)

Code libraries used:
* [earthkit](https://github.com/ecmwf/earthkit)
  * [earthkit-data](https://github.com/ecmwf/earthkit-data)
  * [earthkit-plots](https://github.com/ecmwf/earthkit-plots)
* [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas)
* [xclim](https://xclim.readthedocs.io/en/stable/) climate indicator tools

More about the Copernicus Interactive Climate Atlas and its IPCC predecessor:
* [Copernicus Interactive Climate Atlas application](https://atlas.climate.copernicus.eu/)
* [Gridded data underpinning the Copernicus Interactive Climate Atlas: Description of the datasets and variables](https://confluence.ecmwf.int/display/CKB/Gridded+data+underpinning+the+Copernicus+Interactive+Climate+Atlas%3A+Description+of+the+datasets+and+variables)
* [The Copernicus Interactive Climate Atlas: a tool to explore regional climate change](https://doi.org/10.21957/ah52ufc369)
* [Copernicus Interactive Climate Atlas: a new tool to visualise climate variability and change](https://www.ecmwf.int/en/newsletter/179/news/copernicus-interactive-climate-atlas-new-tool-visualise-climate-variability)
* [Implementation of FAIR principles in the IPCC: the WGI AR6 Atlas repository](https://doi.org/10.1038/s41597-022-01739-y)
* [Climate Change 2021 – The Physical Science Basis: Atlas](https://doi.org/10.1017/9781009157896.021)


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Case study"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q01  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Case study > ℹ If you want to know more > References
---
[[Avila+15](https://doi.org/10.1016/j.wace.2015.06.003)] F. B. Avila et al., ‘Systematic investigation of gridding-related scaling effects on annual statistics of daily temperature and precipitation maxima: A case study for south-east Australia’, Weather and Climate Extremes, vol. 9, pp. 6–16, Aug. 2015, doi: 10.1016/j.wace.2015.06.003.

[[C3S Atlas dataset](https://doi.org/10.24381/cds.h35hb680)] Copernicus Climate Change Service, ‘Gridded dataset underpinning the Copernicus Interactive Climate Atlas’. Copernicus Climate Change Service (C3S) Climate Data Store (CDS), Jun. 17, 2024. doi: 10.24381/cds.h35hb680.

[[CMIP6 dataset](https://doi.org/10.24381/cds.c866074c)] Copernicus Climate Change Service, ‘CMIP6 climate projections’. Copernicus Climate Change Service (C3S) Climate Data Store (CDS), Mar. 23, 2021. doi: 10.24381/cds.c866074c.

[[Gutiérrez+24](https://doi.org/10.21957/ah52ufc369)] J. M. Gutiérrez et al., ‘The Copernicus Interactive Climate Atlas: a tool to explore regional climate change’, ECMWF Newsletter, vol. 181, pp. 38–45, Oct. 2024, doi: 10.21957/ah52ufc369.


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators
---
Production date: 2025-10-01.

Dataset version: 2.0.

Produced by: Olivier Burggraaff, Nicole Reynolds (National Physical Laboratory).


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Quality assessment question
---
* **Are the climate indicators in the dataset underpinning the Copernicus Interactive Climate Atlas consistent with their origin datasets?**
* **Can the dataset underpinning the Copernicus Interactive Climate Atlas be reproduced from its origin datasets?**

The [_Copernicus Interactive Climate Atlas_](https://atlas.climate.copernicus.eu/atlas), or _C3S Atlas_ for short, is a C3S web application providing an easy-to-access tool for exploring climate projections, reanalyses, and observational data [[Gutiérrez+24](https://doi.org/10.21957/ah52ufc369)].
Version 2.0 of the application allows the user to interact with 12 datasets:

| Type               | Dataset       |
|--------------------|---------------|
| Climate Projection | CMIP6         |
| Climate Projection | CMIP5         |
| Climate Projection | CORDEX-CORE   |
| Climate Projection | CORDEX-EUR-11 |
| Reanalysis         | ERA5          |
| Reanalysis         | ERA5-Land     |
| Reanalysis         | ORAS5         |
| Reanalysis         | CERRA         |
| Observations       | E-OBS         |
| Observations       | BERKEARTH     |
| Observations       | CPC           |
| Observations       | SST-CCI       |

These datasets are provided through an intermediary dataset, the [_Gridded dataset underpinning the Copernicus Interactive Climate Atlas_](https://doi.org/10.24381/cds.h35hb680) or _C3S Atlas dataset_ for short [[C3S Atlas dataset](https://doi.org/10.24381/cds.h35hb680)].
Compared to their origins, the versions of the climate datasets within the C3S Atlas dataset have been processed following the workflow in Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q02_workflow-fig>`.

attachment:c3s_atlas_dataset_workflow.png
---
height: 360px
name: multi-origin-c3s-atlas_consistency_q02_workflow-fig
---
Schematic representation of the workflow for the production of the C3S Atlas dataset from its origin datasets, from the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/chapter01.html).
```

Because a wide range of users interact with climate data through the C3S Atlas application, it is crucial that the underpinning dataset represent its origins correctly.
In other words, the C3S Atlas dataset must be consistent with and reproducible from its origins.
Here, we assess this consistency and reproducibility by comparing climate indicators retrieved from the C3S Atlas dataset with their equivalents calculated from the origin dataset, mirroring the workflow from Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q02_workflow-fig>`.
While a full analysis and reproduction of every record within the C3S Atlas dataset is outside the scope of quality assessment
(and would require high-performance computing infrastructure),
a case study with a narrower scope probes these quality attributes of the dataset
and can be a jumping-off point for further analysis by the reader.

This notebook is part of a series:
| Notebook | Contents |
|---|---|
| [](./derived_multi-origin-c3s-atlas_consistency_q01) | Comparison between C3S Atlas dataset and one origin dataset (CMIP6) for one indicator (`tx35`), including detailed setup. |
| **Consistency between the C3S Atlas dataset and its origins: Multiple indicators** | Comparison between C3S Atlas dataset and one origin dataset (CMIP6) for multiple indicators. |
| [](./derived_multi-origin-c3s-atlas_consistency_q03) | Comparison between C3S Atlas dataset and multiple origin datasets for one indicator. |


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Quality assessment statement
---
These are the key outcomes of this assessment

* Climate indicators (here 25 monthly indicators) provided by the C3S Atlas dataset are highly consistent with values calculated from its origin datasets (here the CMIP6 multi-model ensemble).

* There are some differences in coverage between the C3S Atlas dataset and its origins due to deliberate masking, e.g. agricultural indicators in the Arctic circle, but these do not affect the vast majority of use cases for the C3S Atlas.

* Differences between the C3S Atlas dataset and a manual reproduction are rare and generally negligible (median absolute difference ≤0.02% for all but 2 indicators). Where differences occur, they can be explained by details of the workflow implementation or deliberate choices.

* The C3S Atlas is traceable and reproducible, and can be confidently used to view, analyse, and download climate data.

* For specific use cases, like scientific papers, it is recommended to manually process the origin dataset instead of using the C3S Atlas. This is not necessary for other use cases, such as climate risk assessments and climate reports, in which case the C3S Atlas can be used as is.
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Methodology
---
This quality assessment tests the consistency between climate indicators retrieved from the [_Gridded dataset underpinning the Copernicus Interactive Climate Atlas_](https://doi.org/10.24381/cds.h35hb680) [[C3S Atlas dataset](https://doi.org/10.24381/cds.h35hb680)] and their equivalents calculated from the origin datasets,
as well as the reproducibility of said dataset.

This notebook expands the analysis set out in [the case study](./derived_multi-origin-c3s-atlas_consistency_q01)
to investigate multiple indicators
(listed below, descriptions from the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/chapter01.html))
derived from the CMIP6 multi-model ensemble [[CMIP6 dataset](https://doi.org/10.24381/cds.c866074c)]:


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Methodology
---
81/cds.c866074c)]:

| Indicator | Unit | Full description |
|-----------|------|------------------|
| `t`       | °C   | Monthly mean of daily mean near-surface (2-metre) air temperature |
| `tn`      | °C   | Monthly mean of daily minimum near-surface (2-metre) air temperature |
| `tx`      | °C   | Monthly mean of daily maximum near-surface (2-metre) air temperature |
| `dtr`     | °C   | Monthly mean of near-surface (2-metre) air temperature difference between the maximum and minimum daily temperature |
| `tnn`     | °C   | Monthly minimum of daily minimum near-surface (2-metre) air temperature |
| `txx`     | °C   | Monthly maximum of daily maximum near-surface (2-metre) air temperature |
| `tx35`    | d    | Monthly count of days with maximum near-surface (2-metre) temperature above 35 °C |
| `tx40`    | d    | Monthly count of days with maximum near-surface (2-metre) temperature above 40 °C |
| `tr`      | d    | Monthly count of tropical nights (days with minimum temperature above 20 °C) |
| `fd`      | d    | Monthly count of days with minimum near-surface (2-metre) temperature below 0 °C |
| `r`       | mm   | Monthly mean of daily accumulated precipitation of liquid water equivalent from all phases |
| `sdii`    | mm   | Monthly average of daily precipitation amount of liquid water equivalent from all phases on days with precipitation amount above or equal to 1 mm |
| `prsn`    | mm   | Monthly mean of daily accumulated liquid water equivalent thickness snowfall |
| `rx1day`  | mm   | Monthly maximum of 1-day accumulated precipitation of liquid water equivalent from all phases |
| `r01`     | d    | Monthly count of days with daily accumulated precipitation of liquid water equivalent from all phases above 1 mm |
| `r10`     | d    | Monthly count of days with daily accumulated precipitation of liquid water equivalent from all phases above 10 mm |
| `r20`     | d    | Monthly count of days with daily accumulated precipitation of liquid water equivalent from all phases above 20 mm |
| `pet`     | mm   | Monthly mean daily accumulated potential evapotranspiration (Hargreaves method, 1985), which is the rate at which evapotranspiration would occur under ambient conditions from a uniformly vegetated area when the water supply is not limiting |
| `evspsbl` | mm   | Monthly mean of daily amount of water in the atmosphere due to conversion of both liquid and solid phases to vapor (from underlying surface and vegetation) |
| `huss`    | g/kg | Monthly amount of moisture in the air near the surface divided by amount of air plus moisture at that location |
| `psl`     | hPa  | Monthly average air pressure at mean sea level |
| `sfcwind` | m/s  | Monthly mean of daily mean near-surface (10-metre) wind speed |
| `clt`     | %    | Monthly mean cloud cover area percentage |
| `rsds`    | W/m² | Monthly mean incident solar (shortwave) radiation that reaches a horizontal plane at the surface |
| `rlds`    | W/m² | Monthly mean incident thermal (longwave) radiation at the surface (during cloudless and overcast conditions) |
<!--
| `mrsos`   | kg/m²| Monthly soil shallow moisture content, as the vertical sum per unit area of water in all phases contained in the upper soil portion to a depth of 7 to 10 cm (depending on the dataset) |
| `mrro`    | mm   | Monthly mean of daily amount per unit area of surface and subsurface liquid water which drains from land |
-->
<!--
| `cdd`     | d    | Annual maximum of consecutive days when daily accumulated precipitation amount is below 1 mm |
| `hd`      | °C d | Annual energy consumption to heat the deficit of temperature below 15.5 °C |
| `cd`      | °C d | Annual energy consumption to cool the excess of temperature above 22 °C |
-->
<!--
| `rx5day`  | mm   | Monthly maximum of 5-day accumulated precipitation of liquid water equivalent from all phases |
| `spi6`    | —    | Monthly index that compares accumulated precipitation for 6 months with the long-term precipitation distribution for the same location and accumulation period, as the number of standard deviations from the mean. The reference period corresponds to 1971-2010


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Methodology
---
| —    | Monthly index that compares accumulated precipitation for 6 months with the long-term precipitation distribution for the same location and accumulation period, as the number of standard deviations from the mean. The reference period corresponds to 1971-2010

. |
| `spei6`   | —    | Monthly index that compares accumulated precipitation minus potential evapotranspiration (Hargreaves method, 1985) for 6 months with the long-term distribution for the same location and accumulation period, as the number of standard deviations from the mean. The reference period corresponds to 1971-2010.
-->


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Methodology
---
0.
-->

The analysis and results are organised in the following steps, which are detailed in the sections below:

**[](section-codesetup)**
 * Install User-tools for the C3S Atlas.
 * Import all required libraries.
 * Define indicators.
 * Define helper functions.

**[](section-origin)**
 * Download data from the origin dataset(s).
 * Homogenise data.
 * Calculate indicator(s).
 * Regrid the origin data to the C3S Atlas grid.

**[](section-c3s-atlas)**
 * Download data from the C3S Atlas dataset.

**[](section-results)**
 * Consistency: Compare the C3S Atlas and reproduced datasets on native grids.
 * Reproducibility: Compare the C3S Atlas and reproduced datasets on the C3S Atlas grid.


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 1. Code setup
---
This notebook uses [earthkit](https://github.com/ecmwf/earthkit) for
downloading ([earthkit-data](https://github.com/ecmwf/earthkit-data))
and visualising ([earthkit-plots](https://github.com/ecmwf/earthkit-plots)) data.
Because earthkit is in active development, some functionality may change after this notebook is published.
If any part of the code stops functioning, please raise an issue on our GitHub repository so it can be fixed.
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 1. Code setup > Install the User-tools for the C3S Atlas
---
This notebook uses the [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas), which can be installed from GitHub using `pip`.
For convenience, the following cell can do this from within the notebook.
Further details and alternative options for installing this library are available in its [documentation](https://github.com/ecmwf-projects/c3s-atlas?tab=readme-ov-file#requirements).


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 1. Code setup > Import required libraries
---
In this section, we import all the relevant packages needed for running the notebook.

Input / Output
General data handling
Data pre-processing
Climate indicators
Fix for bug affecting sfcWind units
Visualisation
Visualisation in Jupyter book -- automatically ignored otherwise


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 1. Code setup > Define indicators
---
This section defines functions and variables for calculating and using the climate indicators.
These are split into three cells, corresponding to their input and output data types.

Daily data → Monthly indicators:

Daily data -> Monthly indicators
Input: tasmin
Input: tasmax
Input: tasmin + tasmax
Convert to mm (assuming kg water /m² = mm)
Convert to g/kg
Defunct -- problems with units
def cal_rx5day(ds: xr.Dataset) -> xr.Dataset:
""" Monthly maximum of 5-day accumulated precipitation of liquid water equivalent from all phases """
pr_flux = ds['pr'].copy().assign_attrs(units = 'mm/day')
ds_rx5day = xclim.indicators.atmos.max_n_day_precipitation_amount(pr_flux, window=5, freq='MS').to_dataset(name='rx5day')
return ds_rx5day
def cal_spi6(ds: xr.Dataset) -> xr.Dataset:
""" Monthly index that compares accumulated precipitation for 6 months with the long-term precipitation distribution for the same location and accumulation period, as the number of standard deviations from the mean. The reference period corresponds to 1971-2010 """
pr_flux = ds['pr'].copy().assign_attrs(units = 'mm/day')
ds_spi6 = xclim.indices.standardized_precipitation_index(pr_flux, freq='MS', window=6, dist='gamma', method='ML').to_dataset(name='spi6')
return ds_spi6
def cal_spei6(ds: xr.Dataset) -> xr.Dataset:
""" Monthly index that compares accumulated precipitation minus potential evapotranspiration (Hargreaves method, 1985) for 6 months with the long-term distribution for the same location and accumulation period, as the number of standard deviations from the mean. The reference period corresponds to 1971-2010 """
pr_flux = ds['pr'].copy().assign_attrs(units = 'mm/day')
ds_spei6 = xclim.indices.standardized_precipitation_index(pr_flux, freq='MS', window=6, dist='gamma', method='ML').to_dataset(name='spei6')
return ds_spei6

Monthly data → Monthly indicators:

Monthly data -> Monthly indicators
Input: evpsbl
Input: mrsos
Input: sfcWind
Convert to hPa

Monthly data → Yearly indicators.
These yearly indicators are not used in the rest of the analysis, but are included as a jumping-off point for the reader's own analysis.

Daily data -> Yearly indicators
Input: tas + tasmin + tasmax

The following cell defines some convenience functions for calculating multiple indicators in a loop, grouped according to their input and output data types:

Combine functions into dictionaries for easy access by name
Note: Skipping rx5day due to window length error
"rx5day": cal_rx5day,
Note: Skipping spi6, spei6 due to unit issues
"spi6": cal_spi6,
"spei6": cal_spei6,
Note: Skipping mrsos and mrro due to CMIP6 grid issues
"mrsos": cal_mrsos,
"mrro": cal_mrro,
Easier access in loops
Hard-code monthly indicator names to match table in intro
"mrsos", "mrro",
Indicators for which a relative difference can be calculated (e.g. not temperature in °C)
indicators_monthly_names = list(indicators_monthly.keys())
Calculation of multiple indicators

The following cell defines [earthkit-plots styles](https://earthkit-plots.readthedocs.io/en/latest/examples/examples/introduction/05-styles.html) for the indicators.
These styles define the colour maps and colour bar ranges for each quantity.

Styles for indicators
Temperature day indices
Precipitation
Evapotranspiration
Soil moisture
General meteorology
Individual styles
Set up like this so they can still be edited individually
"rx5day": Style(),
"spi6": Style(),
"spei6": Style(),
Apply general settings


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 1. Code setup > Helper functions
---
This section defines some functions and variables used in the following analysis, allowing code cells in later sections to be shorter and ensuring consistency.

##### Data downloading & (pre-)processing

The following functions help with downloading data from datasets with limits, by generating multiple CDS requests with similar parameters:

Create requests for multiple daily / monthly variables
Drop "bnds" variables which can mess with merge later on

The following functions aid in sub-selecting data, e.g. selecting one model from the ensemble included in the C3S Atlas dataset or selecting data for a specific time frame:

C3S Atlas dataset: Individual model selection
Ensure the model ID is provided in the right format
Find the corresponding model ID in the list of models
This cannot use .sel because the coordinate is not indexed
Find the corresponding data and return those
Select (multiple) years in a dataset
Select one month in multiple datasets

The following functions help with downloading C3S Atlas data for one specific ensemble member and a subset of the temporal range (e.g. one year):

C3S Atlas dataset: Download all data, pulling out years and model members of interest
Download data
Drop "bnds" variables which can mess with merge later on
Pick out member
Pick out years

The following functions handle the homogenisation of origin data to a consistent format using the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/intro.html):

Homogenisation of origin dataset

The following functions handle regridding data based on ESMF as implemented in the [User-tools for the C3S Atlas](https://ecmwf-projects.github.io/c3s-atlas/intro.html).
This step is explained in more detail in the relevant section below.

Regridding from native grid to C3S Atlas grid
Note: this only works for monthly, not annual indicators
Ignore repeated warnings on [-90, 90] bounds

##### Statistics
The following functions calculate the difference (absolute / relative) between datasets, handling metadata etc.:

Difference between datasets
Select and calculate
Replace 0/0 with 0

The following functions calculate and display metrics for the difference between two datasets, e.g. mean and median deviation:

If indicators_relative is not specified explicitly, assume it is the same as indicators
Calculate differences
Convert to pandas
Calculate aggregate statistics
Calculate correlation coefficients
Combine statistics into one dataframe

##### Visualisation
The following cells contain functions for plotting results, starting with some base helper functions (e.g. displaying in Jupyter Notebook or Jupyter Book style, adding textboxes with consistent formatting, etc.):

Visualisation: Helper functions, general
Get the plt.Axes for each ekp.Subplot
Set up location
Add the text

The following functions are also base helper functions, but specific to geospatial plots:

Visualisation: Helper functions for geospatial plots
Create subplots

The following cell contains functions for geospatial comparisons between datasets on their native grids or on a common grid (the latter also showing the per-pixel difference):

Visualisation: Plot indicators geospatially
Pre-process: Select data in one month
Setup indicators
Create figure
Plot indicators
Plot individual datasets
Decorate: Text + Colour bar
_add_textbox_to_subplots(year, *subplots_data)
Titles on top
Decorate figure
Visualisation: Plot indicators geospatially
Pre-process: Select data in one month, calculate difference
Setup indicators
Create figure
Plot indicators
Plot individual datasets
Plot difference
Decorate: Text + Colour bar
Titles on top
Decorate figure

The following cell contains functions for histogram comparisons between datasets on their native grids or on a common grid (the latter also showing the per-pixel difference):

Visualisation: Plot data in histograms
Setup indicators
Create figure
Plot histograms of data
Loop over rows / indicators
Loop over columns / data
Flatten data
Create histogram
Identify panel
Titles on top
Visualisation: Plot data + difference in histograms
If indicators_relative is not specified explicitly, assume it is the same as indicators
Calculate difference
Setup indicators
Create figure
Setup x/y share -- cannot be done in plt.subplots because of difference panel not sharing these
Plot histograms of data
Loop over rows / indicators
Loop over columns / data
Flatten data
Create histogram
Plot difference
Plot relative difference
Identify panel
Adjust ylim if too close
Titles on top

(section-origin)=


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 2. Calculate indicators from the origin dataset > Download data
---
This assessment examines the dataset in one year (2080),
for one ensemble member
and
for one climate scenario
– which is not how climate projection data are normally used.
Good practice in climate science is to look at multi-year statistics and trends,
across multiple ensemble members.
However, since the purpose of this assessment is to assess the consistency and reproducibility of the post-processing performed to produce the C3S Atlas dataset,
it is valid to use a subset of the data here.
The specific subset used can be easily tweaked by changing the `EXPERIMENT`, `MODEL`, and `YEARS` variables in this section.

This notebook uses [earthkit-data](https://github.com/ecmwf/earthkit-data) to download files from the CDS.
If you intend to run this notebook multiple times, it is highly recommended that you [enable caching](https://earthkit-data.readthedocs.io/en/latest/concepts/caching.html) to prevent having to download the same files multiple times.
If you prefer not to use earthkit, the following requests can also be used with the [cdsapi module](https://cds.climate.copernicus.eu/how-to-api#linux-use-client-step).
In either case (earthkit-data or cdsapi), it is required to set up a CDS account and API key as explained [on the CDS website](https://cds.climate.copernicus.eu/how-to-api).

The first step is to define the parameters that will be shared between the download of the origin dataset (here CMIP6) and the C3S Atlas dataset (in the [next section](section-c3s-atlas)), namely the experiment and model member.
Next, the request to download the corresponding data from CMIP6 is defined,
in this notebook choosing several daily and monthly variables
defined in the following cell.
To simplify the data processing,
daily and monthly variables are downloaded separately.

VARIABLES_MONTHLY = ["evspsbl", "mrsos", "mrro", "prsn", "sfcWind", "clt", "rsds", "rlds", "psl"]

Setup: General request

Download CMIP6 daily data

```text
<xarray.Dataset> Size: 404MB
Dimensions:  (time: 365, lat: 192, lon: 288)
Coordinates:
  * time     (time) object 3kB 2080-01-01 12:00:00 ... 2080-12-31 12:00:00
  * lat      (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon      (lon) float64 2kB 0.0 1.25 2.5 3.75 5.0 ... 355.0 356.2 357.5 358.8
    height   float64 8B 2.0
Data variables:
    tas      (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    tasmin   (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    tasmax   (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    pr       (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    huss     (time, lat, lon) float32 81MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
Attributes: (12/48)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60225.0
    branch_time_in_parent:  60225.0
    comment:                none
    ...                     ...
    title:                  CMCC-ESM2 output prepared for CMIP6
    variable_id:            tas
    variant_label:          r1i1p1f1
    license:                CMIP6 model data produced by CMCC is licensed und...
    cmor_version:           3.6.0
    tracking_id:            hdl:21.14100/25c823a7-e043-463c-a6b7-4a6f067f78a4
```

Download CMIP6 monthly data


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 2. Calculate indicators from the origin dataset > Download data
---
.0
    tracking_id:            hdl:21.14100/25c823a7-e043-463c-a6b7-4a6f067f78a4
```

Download CMIP6 monthly data

```text
<xarray.Dataset> Size: 19MB
Dimensions:  (time: 12, lat: 192, lon: 288)
Coordinates:
  * time     (time) object 96B 2080-01-16 12:00:00 ... 2080-12-16 12:00:00
  * lat      (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon      (lon) float64 2kB 0.0 1.25 2.5 3.75 5.0 ... 355.0 356.2 357.5 358.8
    height   float64 8B ...
Data variables:
    evspsbl  (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    prsn     (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    sfcWind  (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    clt      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    rsds     (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    rlds     (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    psl      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
Attributes: (12/48)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            ScenarioMIP
    branch_method:          standard
    branch_time_in_child:   60225.0
    branch_time_in_parent:  60225.0
    comment:                none
    ...                     ...
    title:                  CMCC-ESM2 output prepared for CMIP6
    variable_id:            evspsbl
    variant_label:          r1i1p1f1
    license:                CMIP6 model data produced by CMCC is licensed und...
    cmor_version:           3.6.0
    tracking_id:            hdl:21.14100/11eb4243-d050-40aa-bc3a-34b8c1195cb6
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 2. Calculate indicators from the origin dataset > Homogenise data
---
One of the steps in the C3S Atlas dataset production chain is homogenisation, i.e. ensuring consistency between data from different origin datasets.
This homogenisation is implemented in the [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas/tree/main/c3s_atlas), specifically the `c3s_atlas.fixers.apply_fixers` function.
The following changes are applied:

- The names of the spatial coordinates are standardised to `[lon, lat]`.
- Longitude is converted from `[0...360]` to `[-180...180]` format.
- The time coordinate is standardised to the CF standard calendar.
- Variable units are standardised (e.g. °C for temperature).
- Variables are resampled / aggregated to the required temporal resolution.

The homogenisation is applied in the following code cells, separately for the daily and monthly data.
More details can be found in the [case study for `tx35`](./derived_multi-origin-c3s-atlas_consistency_q01).


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 2. Calculate indicators from the origin dataset > Calculate indicators
---
The climate indicators
are calculated using [xclim](https://xclim.readthedocs.io/en/stable/).
The functions defined [above](section-codesetup) perform the calculations.

Annual indicators temporarily disabled due to issues with CF metadata
indicators_cmip6_annual = calculate_indicators_annual(data_cmip6_daily_homogenised)
indicators_cmip6_annual

```text
<xarray.Dataset> Size: 90MB
Dimensions:  (lat: 192, lon: 288, time: 12)
Coordinates:
  * lat      (lat) float64 2kB -90.0 -89.06 -88.12 -87.17 ... 88.12 89.06 90.0
  * lon      (lon) float64 2kB -178.8 -177.5 -176.2 -175.0 ... 177.5 178.8 180.0
    height   float64 8B 2.0
  * time     (time) datetime64[ns] 96B 2080-01-01 2080-02-01 ... 2080-12-01
Data variables: (12/25)
    t        (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    tn       (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    tx       (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    dtr      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    tnn      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    txx      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    ...       ...
    evspsbl  (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    psl      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    sfcwind  (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    clt      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    rsds     (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
    rlds     (time, lat, lon) float32 3MB dask.array<chunksize=(1, 192, 288), meta=np.ndarray>
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 2. Calculate indicators from the origin dataset > Regrid to C3S Atlas grid
---
This notebook uses [xESMF](https://github.com/pangeo-data/xESMF) for regridding data.
xESMF is most easily installed using mamba/conda as explained in its documentation.
Users who cannot or do not wish to use mamba/conda can manually compile and install [ESMF](https://earthsystemmodeling.org/docs/release/latest/ESMF_usrdoc/node10.html) on their machines.
In future, this notebook will use [earthkit-regrid](https://github.com/ecmwf/earthkit-regrid) instead, once it reaches suitable maturity.
```

The final step in the processing is regridding to the standardised grid used in the C3S Atlas dataset (Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q02_workflow-fig>`).
This is performed through a custom function in the [User-tools for the C3S Atlas](https://github.com/ecmwf-projects/c3s-atlas/tree/main/c3s_atlas),
specifically `c3s_atlas.interpolation`.
This function is based on ESMF, as noted above.

Note that the C3S Atlas workflow calculates indicators first, then regrids.
For operations that involve averaging, like smoothing and regridding, the order of operations can affect the result, especially in areas with steep gradients [[Avila+15](https://doi.org/10.1016/j.wace.2015.06.003)].
Examples of such areas for a temperature index are coastlines and mountain ranges.
In the case of C3S Atlas, this order of operations was a conscious choice to preserve the "raw" signals,
e.g. preventing extreme temperatures from being smoothed out.
However, it can affect the indicator values and therefore must be considered when using the C3S Atlas application or dataset,
particularly when intercomparing it with another dataset.

Due to the number of variables involved, this section can take several minutes to run.

```text
<xarray.Dataset> Size: 106MB
Dimensions:   (lon: 360, lat: 180, time: 12, bnds: 2)
Coordinates:
  * lon       (lon) float64 3kB -179.5 -178.5 -177.5 ... 177.5 178.5 179.5
  * lat       (lat) float64 1kB -89.5 -88.5 -87.5 -86.5 ... 86.5 87.5 88.5 89.5
  * time      (time) datetime64[ns] 96B 2080-01-01 2080-02-01 ... 2080-12-01
Dimensions without coordinates: bnds
Data variables: (12/29)
    t         (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    lon_bnds  (lon, bnds) float64 6kB -180.0 -179.0 -179.0 ... 179.0 179.0 180.0
    lat_bnds  (lat, bnds) float64 3kB -90.0 -89.0 -89.0 -88.0 ... 89.0 89.0 90.0
    crs       int64 8B 0
    height    float64 8B 2.0
    tn        (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    ...        ...
    evspsbl   (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    psl       (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    sfcwind   (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    clt       (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    rsds      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
    rlds      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
```


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 2. Calculate indicators from the origin dataset > Regrid to C3S Atlas grid
---
=(1, 180, 360), meta=np.ndarray>
    rlds      (time, lat, lon) float32 3MB dask.array<chunksize=(1, 180, 360), meta=np.ndarray>
```

Annual indicators
indicators_cmip6_annual_regridded = regrid_multiple_variables(indicators_cmip6_annual)
indicators_cmip6_annual_regridded

(section-c3s-atlas)=


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 3. Retrieve indicators from the C3S Atlas dataset
---
Here, we download the same indicators as above directly from the [Gridded dataset underpinning the Copernicus Interactive Climate Atlas](https://doi.org/10.24381/cds.h35hb680) so the values can be compared.

When downloading the C3S Atlas dataset from the CDS, it is not possible to specify a specific year or model like it is for e.g. CMIP6.
Instead, data are downloaded in blocks of several decades and include all model members.
To prevent memory issues from loading so many data at once,
a custom function is used that downloads the data for each indicator and pulls out only the year and model member of interest.
Because this is done in sequence
(one indicator after another)
rather than in parallel (all at the same time, like a normal earthkit-data download),
this can result in the following cells taking relatively long (>1 hour) to run the first time.
After the first time, caching in earthkit-data will (if enabled) speed this section up significantly.

Setup: General request

Download C3S Atlas data
Monthly indicators
Annual indicators
requests_c3s_atlas_annual = create_requests_for_variables(request_c3s_atlas, indicators_annual_names)
indicators_c3s_atlas_annual = download_c3s_atlas_data_onemember(requests_c3s_atlas_annual, YEARS, MODEL)


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 3. Retrieve indicators from the C3S Atlas dataset
---
(requests_c3s_atlas_annual, YEARS, MODEL)

```text
<xarray.Dataset> Size: 78MB
Dimensions:          (time: 12, lat: 180, lon: 360)
Coordinates: (12/16)
  * lat              (lat) float64 1kB -89.5 -88.5 -87.5 ... 87.5 88.5 89.5
  * lon              (lon) float64 3kB -179.5 -178.5 -177.5 ... 178.5 179.5
  * time             (time) datetime64[ns] 96B 2080-01-01 ... 2080-12-01
    member_id        <U23 92B ...
    gcm_institution  <U4 16B ...
    gcm_model        <U9 36B ...
    ...               ...
    threshold20c     float64 8B ...
    threshold0c      float64 8B ...
    threshold1mm     float64 8B 1.0
    threshold10mm    float64 8B ...
    threshold20mm    float64 8B ...
    height10m        float64 8B ...
Data variables: (12/26)
    t                (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    crs              int32 4B -2147483647
    tn               (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    tx               (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    dtr              (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    tnn              (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    ...               ...
    huss             (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    psl              (time, lat, lon) float32 3MB dask.array<chunksize=(12, 23, 52), meta=np.ndarray>
    sfcwind          (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    clt              (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
    rsds             (time, lat, lon) float32 3MB dask.array<chunksize=(12, 23, 45), meta=np.ndarray>
    rlds             (time, lat, lon) float32 3MB dask.array<chunksize=(12, 26, 52), meta=np.ndarray>
Attributes: (12/26)
    Conventions:                CF-1.9 ACDD-1.3
    title:                      Copernicus Interactive Climate Atlas: gridded...
    summary:                    Monthly/annual gridded data from observations...
    institution:                Copernicus Climate Change Service (C3S)
    producers:                  Institute of Physics of Cantabria (IFCA, CSIC...
    license:                    CC-BY 4.0, https://creativecommons.org/licens...
    ...                         ...
    geospatial_lon_min:         -180.0
    geospatial_lon_max:         180.0
    geospatial_lon_resolution:  1.0
    geospatial_lon_units:       degrees_east
    date_created:               2024-12-05 15:51:48.916442+01:00
    tracking_id:                89974d82-56b6-4b47-958e-5954716013d3
```

indicators_c3s_atlas_annual

(section-results)=


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 4. Results
---
This section contains the comparison between the indicator values retrieved from the C3S Atlas dataset vs those reproduced from the origin dataset.

The datasets are first compared on their native grids.
This means a point-by-point comparison is not possible
(because the points are not equivalent),
but the distributions can be compared geospatially and overall.
This qualitative comparison probes the consistency quality attribute:
Are the climate indicators in the dataset underpinning the Copernicus Interactive Climate Atlas consistent with their origin datasets?

Second, the C3S Atlas dataset is compared to the indicators derived from the origin dataset and regridded to the C3S Atlas grid.
This makes a quantitative point-by-point comparison possible.
This second comparison probes how well the dataset underpinning the Copernicus Interactive Climate Atlas can be reproduced from its origin datasets,
based on the workflow (Figure {numref}`{number} <multi-origin-c3s-atlas_consistency_q02_workflow-fig>`).

For the geospatial comparison,
we display the values of the indicators for one month,
across one region and globally.
As an example, we display the results across
Europe
in
June,
which should provide significant spatial variation.
This region can easily be modified in the following code cell using the [domains provided by earthkit-plots](https://earthkit-plots.readthedocs.io/en/latest/examples/examples/introduction/07-domains.html).
Some examples are provided in the cell (commented out using `#`).

Setup: Choose a month to display
Setup: Pick domain using earthkit-plots
domain = "Mediterranean"
Other examples -- uncomment where desired
domain = ekp.geo.domains.union(["Portugal", "Spain"], name="Iberia")
domain = "Italy"
domain = "South America"


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 4. Results > Consistency: Comparison on native grids
---
As in the [case study for `tx35`](./derived_multi-origin-c3s-atlas_consistency_q01),
it is clear from the geospatial comparison
(Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q02_fig-geo-regional>`)
that the C3S Atlas dataset closely resembles a manual reproduction from its origin datasets.
The general distribution of indicator values is the same for
all indicators.
In a few cases,
such as
`sdii` (northern Africa, north of the Caspian Sea)
and
`pet` (northern Africa, seas, within the Arctic circle),
the two datasets differ in terms of coverage.
For `pet`,
this difference is due to a deliberate decision in the C3S Atlas workflow
to mask areas where agricultural studies do not make sense,
such as arid regions, areas permanently covered by ice, and regions with no vegetation.
This masking is explained in a [Jupyter notebook written by the data provider](https://github.com/ecmwf-projects/c3s-atlas/blob/main/auxiliar/barrean_mask.ipynb).

This pattern is also visible in the overall distributions
(Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q02_fig-hist-native>`),
which are again very similar for almost all indicators.
The distributions only differ clearly for
`sdii`
and
`pet`,
due to the aforementioned gaps and masks.

The overall conclusion from this comparison is the same as in the [case study for `tx35`](./derived_multi-origin-c3s-atlas_consistency_q01).
The C3S Atlas dataset and its origins are highly consistent,
but small differences exist due to the difference in grid.
There are also differences in data availability for some indicators,
due to deliberate masking of specific areas.
Users of the C3S Atlas dataset
– and thus users of the C3S Atlas application –
should be aware that the indicator values retrieved for a specific location may differ slightly from a manual analysis of the origin dataset.

Geospatial plot: Monthly indicators
Geospatial plot: Annual indicators
geospatial_comparison_multiple_indicators(indicators_c3s_atlas_annual, indicators_cmip6_annual, indicators_annual_names, 1, domain=domain)

Histogram: Monthly indicators
Histogram: Annual indicators
fig_hist = histogram_comparison_by_indicator(indicators_c3s_atlas_annual, indicators_cmip6_annual, indicators_annual_names)

::::{tab-set}
:::{tab-item} Geospatial comparison
:sync: geo
 derived_multi-origin-c3s-atlas_consistency_q02_fig-geo-regional
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q02_fig-geo-regional"

Comparison between C3S Atlas dataset and reproduction for multiple indicators in one month,
across Europe,
on the native grid of each dataset.
```
:::
:::{tab-item} Overall comparison
:sync: hist
 derived_multi-origin-c3s-atlas_consistency_q02_fig-hist-native
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q02_fig-hist-native"

Comparison between overall distributions of indicator values in the C3S Atlas dataset and its reproduction,
across all spatial and temporal dimensions,
on the native grid of each dataset.
```
:::
::::


EQC Quality Assessment: "Consistency between the C3S Atlas dataset and its origins: Multiple indicators"
Dataset: multi-origin-c3s-atlas [CDS]
Aspect: consistency_q02  |  Category: Derived_Datasets
Section: Consistency between the C3S Atlas dataset and its origins: Multiple indicators > Analysis and results > 4. Results > Reproducibility: Comparison on C3S Atlas grid
---
After regridding to the C3S Atlas grid,
the indicator values reproduced from the origin dataset
can be compared point-by-point to the values retrieved from the C3S Atlas dataset.
We first examine some metrics that describe the difference Δ between corresponding pixels:

As in the [case study for `tx35`](./derived_multi-origin-c3s-atlas_consistency_q01),
it is clear that
the C3S Atlas dataset and its manual reproduction
are very similar.
The median difference, median absolute difference, and median absolute percentage difference
are all close to 0 for
almost all indicators.

The percentage of pixels with a non-zero difference
(defined here as |Δ| ≥ ε with ε = 10{sup}`–5` to avoid floating-point errors)
is a less useful metric here since most of the indicators are
real numbers,
rather than integers like `tx35`.
This leaves more room for small differences in the data to appear due to
small changes in the origin dataset and/or the C3S Atlas workflow software,
which for an integer indicator like `tx35` would tend to be rounded off.
For most indicators,
the relative difference between datasets is ≤0.1% for
the vast majority of point-by-point comparisons.

The distributions of indicator values and differences
(Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q02_fig-hist-c3s-atlas>`)
confirm that the differences between the two datasets tend to be very small,
with distributions centered around 0 and few outliers.

It is not clear why some indicators show larger differences.
For `pet`, the differences are due to masking in a specific region
(Northern Fennoscandia; Figure {numref}`{number} <derived_multi-origin-c3s-atlas_consistency_q02_fig-geocomp-regional>`),
as discussed before.
However, the same is not true for the daily precipitation indicators
`r01`,
`r10`,
and
`r20`.
These particular indicators show high values and significant spread across Europe in June
(and presumably in other months)
meaning the differences may simply be due to regridding.
This also explains why there are non-integer differences:
since the C3S Atlas workflow calculates indicators and _then_ regrids,
the regridded indicators can have non-integer values.
Similar effects can be seen in other indicators when converting between integer and floating-point data types.

We can extend the conclusion from the [`tx35` case study](./derived_multi-origin-c3s-atlas_consistency_q01),
namely that the C3S Atlas dataset can be considered practically reproducible.
However,
some of the indicators show non-zero differences,
either
in specific locations
(e.g. `pet`)
or
distributed randomly
(e.g. `r01`).
These differences are caused
either
by deliberate decisions to mask certain regions
or
(likely)
by small differences in the data processing.
They are small and rare enough to be negligible for most users using the C3S Atlas dataset,
especially since they will typically use it through the application.
For further analysis,
it is generally best to manually process the origin dataset,
if only to remove the amount of steps that may affect the result.

Geospatial plot: Monthly indicators

Histogram: Monthly indicators

::::{tab-set}
:::{tab-item} Geospatial comparison
:sync: geo
 derived_multi-origin-c3s-atlas_consistency_q02_fig-geocomp-regional
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q02_fig-geocomp-regional"

Comparison between C3S Atlas dataset and reproduction for multiple indicators in one month,
across Europe,
on the C3S Atlas dataset grid,
including the per-pixel difference.
```
:::
:::{tab-item} Overall comparison
:sync: hist
 derived_multi-origin-c3s-atlas_consistency_q02_fig-hist-c3s-atlas
:figwidth: 700px
:name: "derived_multi-origin-c3s-atlas_consistency_q02_fig-hist-c3s-atlas"

Comparison between overall distributions of indicator values in the C3S Atlas dataset and its reproduction
on the C3S Atlas grid,
across all spatial and temporal dimensions,
including the per-pixel difference.
```
:::
::::