<a id="facets"></a>

# Facets

A facet is a key-value pair that describes a certain property of a dataset and
enables [faceted search](https://en.wikipedia.org/wiki/Faceted_search), for
example as provided by [ESGF](https://esgf-node.ornl.gov/search).
The facets used on ESGF are closely related to the global attributes defined by
the [controlled vocabulary](https://en.wikipedia.org/wiki/Controlled_vocabulary)
used by the various “project”s hosted on ESGF. A “project” is a collection of
datasets that share certain properties, e.g.
[CMIP7](https://wcrp-cmip.org/cmip-phases/cmip7/) is a project.
Each project has its own set of facets that are relevant for that project.
The documents linked below provide an overview of the official facets for
various projects. They also provide a reference directory structure and file naming
convention based on facets, which is used to organise data on local filesystems.

ESMValCore uses “facets” to search for and define input data, both in the
[recipe](../recipe/index.html.md#recipe) and in the [`Dataset`](../api/esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset) object.
This allows specifying data without relying on e.g. file names or directory
structures, which may vary between computers. ESMValCore uses its own set of
facets, which is consistent across all projects it supports.

Here is a mapping from the facet names used in ESMValCore to the corresponding
project specific facet names used on ESGF.

## CMIP7

[Official CMIP7 facets](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Global_Attributes/).

#### NOTE
This mapping is preliminary as no CMIP7 data has been published on ESGF yet.

| ESMValCore facet   | ESGF facet                 |
|--------------------|----------------------------|
| `activity`         | `activity_id`              |
| `branding_suffix`  | `variable_branding_suffix` |
| `dataset`          | `source_id`                |
| `ensemble`         | `variant_label`            |
| `exp`              | `experiment_id`            |
| `frequency`        | `frequency`                |
| `grid`             | `grid_label`               |
| `mip`              | `realm`                    |
| `institute`        | `institution_id`           |
| `realm`            | `realm`                    |
| `region`           | `region`                   |
| `project`          | `project` / `mip_era`      |
| `short_name`       | `variable_id`              |
| `version`          | `version`                  |

## CMIP6

[Official CMIP6 facets](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP6/global_attributes/).

| ESMValCore facet   | ESGF facet            |
|--------------------|-----------------------|
| `activity`         | `activity_id`         |
| `dataset`          | `source_id`           |
| `ensemble`         | `member_id`           |
| `exp`              | `experiment_id`       |
| `frequency`        | `frequency`           |
| `grid`             | `grid_label`          |
| `institute`        | `institution_id`      |
| `mip`              | `table_id`            |
| `realm`            | `realm`               |
| `project`          | `project` / `mip_era` |
| `short_name`       | `variable_id`         |

## CMIP6Plus

[Official CMIP6Plus information](https://wcrp-cmip.org/cmip-phases/cmip6plus/).

The facet mapping is the same as for CMIP6. Note that CMIP6Plus uses updated
MIP table names (e.g. `APmon` instead of `Amon`); see
[mip-cmor-tables](https://github.com/PCMDI/mip-cmor-tables).

| ESMValCore facet   | ESGF facet            |
|--------------------|-----------------------|
| `activity`         | `activity_id`         |
| `dataset`          | `source_id`           |
| `ensemble`         | `member_id`           |
| `exp`              | `experiment_id`       |
| `frequency`        | `frequency`           |
| `grid`             | `grid_label`          |
| `institute`        | `institution_id`      |
| `mip`              | `table_id`            |
| `realm`            | `realm`               |
| `project`          | `project` / `mip_era` |
| `short_name`       | `variable_id`         |

## CMIP5

[Official CMIP5 facets](https://pcmdi.github.io/mips/cmip5/docs/CMIP5_output_metadata_requirements.pdf).
Note that there appear to be differences between the official facets and those
used on ESGF. Below we present the facets used on ESGF.

| ESMValCore facet   | ESGF facet       |
|--------------------|------------------|
| `dataset`          | `model`          |
| `ensemble`         | `ensemble`       |
| `exp`              | `experiment`     |
| `frequency`        | `time_frequency` |
| `institute`        | `institute`      |
| `mip`              | `cmor_table`     |
| `realm`            | `realm`          |
| `product`          | `product`        |
| `project`          | `project`        |
| `short_name`       | `variable`       |

## CMIP3

| ESMValCore facet   | ESGF facet       |
|--------------------|------------------|
| `dataset`          | `model`          |
| `ensemble`         | `ensemble`       |
| `exp`              | `experiment`     |
| `frequency`        | `time_frequency` |
| `short_name`       | `variable`       |

## CORDEX-CMIP6

[Official CORDEX-CMIP6 facets](https://doi.org/10.5281/zenodo.10961068).

| ESMValCore facet   | ESGF facet              |
|--------------------|-------------------------|
| `activity`         | `activity_id`           |
| `dataset`          | `source_id`             |
| `driver`           | `driving_source_id`     |
| `domain`           | `domain_id`             |
| `ensemble`         | `driving_variant_label` |
| `exp`              | `driving_experiment_id` |
| `frequency`        | `frequency`             |
| `institute`        | `institution_id`        |
| `project`          | `project_id`            |
| `rcm_version`      | `version_realization`   |
| `short_name`       | `variable_id`           |

## CORDEX

[Official CORDEX-CMIP5 facets](https://zenodo.org/records/15223120).
Note that there appear to be differences between the official facets and those
used on ESGF. Below we present the facets used on ESGF.

| ESMValCore facet   | ESGF facet       |
|--------------------|------------------|
| `dataset`          | `rcm_name`       |
| `driver`           | `driving_model`  |
| `domain`           | `domain`         |
| `ensemble`         | `ensemble`       |
| `exp`              | `experiment`     |
| `frequency`        | `time_frequency` |
| `institute`        | `institute`      |
| `rcm_version`      | `rcm_version`    |
| `short_name`       | `variable`       |

## obs4MIPs

[Official obs4MIPs facets](https://doi.org/10.5281/zenodo.11500473).
Note that obs4MIPs first followed the CMIP5 conventions before switching to
the CMIP6 conventions. That means that both conventions are in use depending on
when a particular dataset was published. See the CMIP5 and CMIP6 tables above
for the mappings.
