# CMOR functions

CMOR module.

## Checking compliance

Module for checking iris cubes against their CMOR definitions.

**Classes:**

| [`CheckLevels`](#esmvalcore.cmor.check.CheckLevels)(\*values)                       | Level of strictness of the checks.                   |
|----------------------------------------------------------------------------------------------|------------------------------------------------------|
| [`CMORCheck`](#esmvalcore.cmor.check.CMORCheck)(cube, var_info[, frequency, ...]) | Class used to check the CMOR-compliance of the data. |

**Exceptions:**

| [`CMORCheckError`](#esmvalcore.cmor.check.CMORCheckError)   | Exception raised when a cube does not pass the CMORCheck.   |
|-------------------------------------------------------------------|-------------------------------------------------------------|

**Functions:**

| [`cmor_check_metadata`](#esmvalcore.cmor.check.cmor_check_metadata)(cube, cmor_table, mip, ...)   | Check if metadata conforms to variable's CMOR definition.   |
|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [`cmor_check_data`](#esmvalcore.cmor.check.cmor_check_data)(cube, cmor_table, mip, ...)       | Check if data conforms to variable's CMOR definition.       |
| [`cmor_check`](#esmvalcore.cmor.check.cmor_check)(cube, cmor_table, mip, short_name, \*) | Check if cube conforms to variable's CMOR definition.       |

### *class* esmvalcore.cmor.check.CheckLevels(\*values)

Bases: [`IntEnum`](https://docs.python.org/3/library/enum.html#enum.IntEnum)

Level of strictness of the checks.

**Attributes:**

| [`DEBUG`](#esmvalcore.cmor.check.CheckLevels.DEBUG)   | Report any debug message that the checker wants to communicate.    |
|----------------------------------------------------------|--------------------------------------------------------------------|
| [`STRICT`](#esmvalcore.cmor.check.CheckLevels.STRICT)  | Fail if there are warnings regarding compliance of CMOR standards. |
| [`DEFAULT`](#esmvalcore.cmor.check.CheckLevels.DEFAULT) | Fail if cubes present any discrepancy with CMOR standards.         |
| [`RELAXED`](#esmvalcore.cmor.check.CheckLevels.RELAXED) | Fail if cubes present severe discrepancies with CMOR standards.    |
| [`IGNORE`](#esmvalcore.cmor.check.CheckLevels.IGNORE)  | Do not fail for any discrepancy with CMOR standards.               |

#### DEBUG *= 1*

Report any debug message that the checker wants to communicate.

#### STRICT *= 2*

Fail if there are warnings regarding compliance of CMOR standards.

#### DEFAULT *= 3*

Fail if cubes present any discrepancy with CMOR standards.

#### RELAXED *= 4*

Fail if cubes present severe discrepancies with CMOR standards.

#### IGNORE *= 5*

Do not fail for any discrepancy with CMOR standards.

### *exception* esmvalcore.cmor.check.CMORCheckError

Bases: [`Exception`](https://docs.python.org/3/builtins/exceptions.html#Exception)

Exception raised when a cube does not pass the CMORCheck.

### *class* esmvalcore.cmor.check.CMORCheck(cube, var_info, frequency=None, fail_on_error=False, check_level=CheckLevels.DEFAULT)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Class used to check the CMOR-compliance of the data.

* **Parameters:**
  * **cube** (*iris.cube.Cube:*) – Iris cube to check.
  * **var_info** (*variables_info.VariableInfo*) – Variable info to check.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Expected frequency for the data. If not given, use the one from the
    variable information.
  * **fail_on_error** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – If true, CMORCheck stops on the first error. If false, it collects
    all possible errors before stopping.
  * **check_level** ([*CheckLevels*](#esmvalcore.cmor.check.CheckLevels)) – Level of strictness of the checks.

#### frequency

Expected frequency for the data.

* **Type:**
  [str](https://docs.python.org/3/builtins/stdtypes.html#str)

**Methods:**

| [`check_metadata`](#esmvalcore.cmor.check.CMORCheck.check_metadata)([logger])              | Check the cube metadata.                            |
|----------------------------------------------------------------------------------------|-----------------------------------------------------|
| [`check_data`](#esmvalcore.cmor.check.CMORCheck.check_data)([logger])                  | Check the cube data.                                |
| [`report_errors`](#esmvalcore.cmor.check.CMORCheck.report_errors)()                       | Report detected errors.                             |
| [`report_warnings`](#esmvalcore.cmor.check.CMORCheck.report_warnings)()                     | Report detected warnings to the given logger.       |
| [`report_debug_messages`](#esmvalcore.cmor.check.CMORCheck.report_debug_messages)()               | Report detected debug messages to the given logger. |
| [`has_errors`](#esmvalcore.cmor.check.CMORCheck.has_errors)()                          | Check if there are reported errors.                 |
| [`has_warnings`](#esmvalcore.cmor.check.CMORCheck.has_warnings)()                        | Check if there are reported warnings.               |
| [`has_debug_messages`](#esmvalcore.cmor.check.CMORCheck.has_debug_messages)()                  | Check if there are reported debug messages.         |
| [`report`](#esmvalcore.cmor.check.CMORCheck.report)(level, message, \*args)        | Report a message from the checker.                  |
| [`report_critical`](#esmvalcore.cmor.check.CMORCheck.report_critical)(message, \*args)      | Report an error.                                    |
| [`report_error`](#esmvalcore.cmor.check.CMORCheck.report_error)(message, \*args)         | Report a normal error.                              |
| [`report_warning`](#esmvalcore.cmor.check.CMORCheck.report_warning)(message, \*args)       | Report a warning level error.                       |
| [`report_debug_message`](#esmvalcore.cmor.check.CMORCheck.report_debug_message)(message, \*args) | Report a debug message.                             |

#### check_metadata(logger: [logging.Logger](https://docs.python.org/3/library/logging.html#logging.Logger) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → Cube

Check the cube metadata.

It will also report some warnings in case of minor errors.

* **Parameters:**
  **logger** ([*logging.Logger*](https://docs.python.org/3/library/logging.html#logging.Logger) *|* *None*) – Given logger.
* **Returns:**
  Checked cube.
* **Return type:**
  [iris.cube.Cube](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)
* **Raises:**
  [**CMORCheckError**](#esmvalcore.cmor.check.CMORCheckError) – If errors are found. If fail_on_error attribute is set to True,
      raises as soon as an error is detected. If set to False, it perform
      all checks and then raises.

#### check_data(logger: [logging.Logger](https://docs.python.org/3/library/logging.html#logging.Logger) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → Cube

Check the cube data.

Assumes that metadata is correct, so you must call check_metadata prior
to this.

It will also report some warnings in case of minor errors.

* **Parameters:**
  **logger** ([*logging.Logger*](https://docs.python.org/3/library/logging.html#logging.Logger) *|* *None*) – Given logger.
* **Returns:**
  Checked cube.
* **Return type:**
  [iris.cube.Cube](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)
* **Raises:**
  [**CMORCheckError**](#esmvalcore.cmor.check.CMORCheckError) – If errors are found. If fail_on_error attribute is set to True,
      raises as soon as an error is detected. If set to False, it perform
      all checks and then raises.

#### report_errors()

Report detected errors.

* **Raises:**
  [**CMORCheckError**](#esmvalcore.cmor.check.CMORCheckError) – If any errors were reported before calling this method.

#### report_warnings()

Report detected warnings to the given logger.

#### report_debug_messages()

Report detected debug messages to the given logger.

#### has_errors()

Check if there are reported errors.

* **Returns:**
  True if there are pending errors, False otherwise.
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

#### has_warnings()

Check if there are reported warnings.

* **Returns:**
  True if there are pending warnings, False otherwise.
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

#### has_debug_messages()

Check if there are reported debug messages.

* **Returns:**
  True if there are pending debug messages, False otherwise.
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

#### report(level, message, \*args)

Report a message from the checker.

* **Parameters:**
  * **level** ([*CheckLevels*](#esmvalcore.cmor.check.CheckLevels)) – Message level
  * **message** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Message to report
  * **args** – String format args for the message
* **Raises:**
  [**CMORCheckError**](#esmvalcore.cmor.check.CMORCheckError) – If fail on error is set, it is thrown when registering an error
      message

#### report_critical(message, \*args)

Report an error.

If fail_on_error is set to True, raises automatically.
If fail_on_error is set to False, stores it for later reports.

* **Parameters:**
  * **message** (*str: unicode*) – Message for the error.
  * **\*args** – arguments to format the message string.

#### report_error(message, \*args)

Report a normal error.

* **Parameters:**
  * **message** (*str: unicode*) – Message for the error.
  * **\*args** – arguments to format the message string.

#### report_warning(message, \*args)

Report a warning level error.

* **Parameters:**
  * **message** (*str: unicode*) – Message for the warning.
  * **\*args** – arguments to format the message string.

#### report_debug_message(message, \*args)

Report a debug message.

* **Parameters:**
  * **message** (*str: unicode*) – Message for the debug logger.
  * **\*args** – arguments to format the message string

### esmvalcore.cmor.check.cmor_check_metadata(cube: Cube, cmor_table: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, frequency: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, check_level: [CheckLevels](#esmvalcore.cmor.check.CheckLevels) = CheckLevels.DEFAULT) → Cube

Check if metadata conforms to variable’s CMOR definition.

None of the checks at this step will force the cube to load the data.

* **Parameters:**
  * **cube** (*Cube*) – Data cube to check.
  * **cmor_table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – CMOR definitions to use (i.e., the variable’s project).
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s MIP.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table. Used by the CMIP7 project.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – Data frequency. If not given, use the one from the CMOR table of the
    variable.
  * **check_level** ([*CheckLevels*](#esmvalcore.cmor.check.CheckLevels)) – Level of strictness of the checks.
* **Returns:**
  Checked cube.
* **Return type:**
  [iris.cube.Cube](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)

### esmvalcore.cmor.check.cmor_check_data(cube: Cube, cmor_table: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, frequency: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, check_level: [CheckLevels](#esmvalcore.cmor.check.CheckLevels) = CheckLevels.DEFAULT) → Cube

Check if data conforms to variable’s CMOR definition.

* **Parameters:**
  * **cube** (*Cube*) – Data cube to check.
  * **cmor_table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – CMOR definitions to use (i.e., the variable’s project).
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s MIP.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table. Used by the CMIP7 project.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – Data frequency. If not given, use the one from the CMOR table of the
    variable.
  * **check_level** ([*CheckLevels*](#esmvalcore.cmor.check.CheckLevels)) – Level of strictness of the checks.
* **Returns:**
  Checked cube.
* **Return type:**
  [iris.cube.Cube](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)

### esmvalcore.cmor.check.cmor_check(cube: Cube, cmor_table: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, frequency: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, check_level: [CheckLevels](#esmvalcore.cmor.check.CheckLevels) = CheckLevels.DEFAULT) → Cube

Check if cube conforms to variable’s CMOR definition.

Equivalent to calling [`cmor_check_metadata()`](#esmvalcore.cmor.check.cmor_check_metadata) and
[`cmor_check_data()`](#esmvalcore.cmor.check.cmor_check_data) consecutively.

* **Parameters:**
  * **cube** (*Cube*) – Data cube to check.
  * **cmor_table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – CMOR definitions to use (i.e., the variable’s project).
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s MIP.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table. Used by the CMIP7 project.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – Data frequency. If not given, use the one from the CMOR table of the
    variable.
  * **check_level** ([*CheckLevels*](#esmvalcore.cmor.check.CheckLevels)) – Level of strictness of the checks.
* **Returns:**
  Checked cube.
* **Return type:**
  [iris.cube.Cube](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)

## Automatically fixing issues

Apply automatic fixes for known errors in cmorized data.

All functions in this module will work even if no fixes are available
for the given dataset. Therefore is recommended to apply them to all
variables to be sure that all known errors are fixed.

**Functions:**

| [`fix_data`](#esmvalcore.cmor.fix.fix_data)(cube, short_name, project, dataset, mip)   | Fix cube data if fixes are required.                                                                                                               |
|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| [`fix_file`](#esmvalcore.cmor.fix.fix_file)(file, short_name, project, dataset, ...)   | Fix files before loading them into a [`CubeList`](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.CubeList). |
| [`fix_metadata`](#esmvalcore.cmor.fix.fix_metadata)(cubes, short_name, project, ...)       | Fix cube metadata if fixes are required.                                                                                                           |

### esmvalcore.cmor.fix.fix_data(cube: Cube, short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), project: [str](https://docs.python.org/3/builtins/stdtypes.html#str), dataset: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), frequency: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, session: [Session](esmvalcore.config.html.md#esmvalcore.config.Session) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \*\*extra_facets: Any) → Cube

Fix cube data if fixes are required.

This method assumes that metadata is already fixed and checked.

This method collects all the relevant fixes (including generic ones) for a
given variable and applies them.

* **Parameters:**
  * **cube** (*Cube*) – Cube to fix.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name.
  * **project** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Project of the dataset.
  * **dataset** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the dataset.
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s MIP.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – Variable’s data frequency, if available.
  * **session** ([*Session*](esmvalcore.config.html.md#esmvalcore.config.Session) *|* *None*) – Current session which includes configuration and directory information.
  * **\*\*extra_facets** (*Any*) – Extra facets. For details, see [Extra Facets](../quickstart/configure.html.md#config-extra-facets).
* **Returns:**
  Fixed cube.
* **Return type:**
  [iris.cube.Cube](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)

### esmvalcore.cmor.fix.fix_file(file: Path, short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), project: [str](https://docs.python.org/3/builtins/stdtypes.html#str), dataset: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), output_dir: Path, add_unique_suffix: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, session: [Session](esmvalcore.config.html.md#esmvalcore.config.Session) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, frequency: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \*\*extra_facets: Any) → Path | Sequence[Cube]

Fix files before loading them into a [`CubeList`](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.CubeList).

This is mainly intended to fix errors that prevent loading the data with
Iris (e.g., those related to `missing_value` or `_FillValue`) or
operations that are more efficient with other packages (e.g., loading files
with lots of variables is much faster with Xarray than Iris).

* **Parameters:**
  * **file** (*Path*) – Path to the original file. Original files are not overwritten.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name.
  * **project** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Project of the dataset.
  * **dataset** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the dataset.
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s MIP.
  * **output_dir** (*Path*) – Output directory for fixed files.
  * **add_unique_suffix** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Adds a unique suffix to `output_dir` for thread safety.
  * **session** ([*Session*](esmvalcore.config.html.md#esmvalcore.config.Session) *|* *None*) – Current session which includes configuration and directory information.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – Variable’s data frequency, if available.
  * **\*\*extra_facets** (*Any*) – Extra facets. For details, see [Extra Facets](../quickstart/configure.html.md#config-extra-facets).
* **Returns:**
  Fixed data or a path to them.
* **Return type:**
  Path | Sequence[Cube]

### esmvalcore.cmor.fix.fix_metadata(cubes: Sequence[Cube], short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), project: [str](https://docs.python.org/3/builtins/stdtypes.html#str), dataset: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), frequency: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, session: [Session](esmvalcore.config.html.md#esmvalcore.config.Session) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, \*\*extra_facets: Any) → CubeList

Fix cube metadata if fixes are required.

This method collects all the relevant fixes (including generic ones) for a
given variable and applies them.

* **Parameters:**
  * **cubes** (*Sequence* *[**Cube* *]*) – Cubes to fix.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name.
  * **project** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Project of the dataset.
  * **dataset** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the dataset.
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s MIP.
  * **frequency** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – Variable’s data frequency, if available.
  * **session** ([*Session*](esmvalcore.config.html.md#esmvalcore.config.Session) *|* *None*) – Current session which includes configuration and directory information.
  * **\*\*extra_facets** (*Any*) – Extra facets. For details, see [Extra Facets](../quickstart/configure.html.md#config-extra-facets).
* **Returns:**
  Fixed cubes.
* **Return type:**
  [iris.cube.CubeList](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.CubeList)

## Functions for fixing issues

Functions for fixing specific issues with datasets.

**Functions:**

| [`add_altitude_from_plev`](#esmvalcore.cmor.fixes.add_altitude_from_plev)(cube)   | Add altitude coordinate from pressure level coordinate.   |
|---------------------------------------------------------------------------------|-----------------------------------------------------------|
| [`add_plev_from_altitude`](#esmvalcore.cmor.fixes.add_plev_from_altitude)(cube)   | Add pressure level coordinate from altitude coordinate.   |
| [`get_next_month`](#esmvalcore.cmor.fixes.get_next_month)(month, year)    | Get next month and year.                                  |
| [`get_time_bounds`](#esmvalcore.cmor.fixes.get_time_bounds)(time, freq)    | Get bounds for time coordinate.                           |

### esmvalcore.cmor.fixes.add_altitude_from_plev(cube)

Add altitude coordinate from pressure level coordinate.

* **Parameters:**
  **cube** ([*iris.cube.Cube*](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)) – Input cube.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – `cube` does not contain coordinate `air_pressure`.

### esmvalcore.cmor.fixes.add_plev_from_altitude(cube)

Add pressure level coordinate from altitude coordinate.

* **Parameters:**
  **cube** ([*iris.cube.Cube*](https://scitools-iris.readthedocs.io/en/stable/generated/api/iris.cube.html#iris.cube.Cube)) – Input cube.
* **Raises:**
  [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – `cube` does not contain coordinate `altitude`.

### esmvalcore.cmor.fixes.get_next_month(month: [int](https://docs.python.org/3/builtins/functions.html#int), year: [int](https://docs.python.org/3/builtins/functions.html#int)) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), [int](https://docs.python.org/3/builtins/functions.html#int)]

Get next month and year.

* **Parameters:**
  * **month** ([*int*](https://docs.python.org/3/builtins/functions.html#int)) – Current month.
  * **year** ([*int*](https://docs.python.org/3/builtins/functions.html#int)) – Current year.
* **Returns:**
  Next month and next year.
* **Return type:**
  [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[int](https://docs.python.org/3/builtins/functions.html#int), [int](https://docs.python.org/3/builtins/functions.html#int)]

### esmvalcore.cmor.fixes.get_time_bounds(time: Coord, freq: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → np.ndarray

Get bounds for time coordinate.

For decadal data, use 1 January 5 years before/after the current year. For
yearly data, use 1 January of the current year and 1 January of the next
year. For monthly data, use the first day of the current month and the
first day of the next month. For other frequencies (daily or n-hourly,
where n is a divisor of 24), half of the frequency is subtracted/added
from the current point in time to get the bounds.

* **Parameters:**
  * **time** (*Coord*) – Time coordinate.
  * **freq** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Frequency.
* **Returns:**
  Time bounds
* **Return type:**
  np.ndarray
* **Raises:**
  [**NotImplementedError**](https://docs.python.org/3/builtins/exceptions.html#NotImplementedError) – Non-supported frequency is given.

## Using CMOR tables

CMOR information reader for ESMValTool.

Read variable information from CMOR 2 and CMOR 3 tables and make it
easily available for the other components of ESMValTool

**Classes:**

| [`CMIP3Info`](#esmvalcore.cmor.table.CMIP3Info)(\*[, paths, alt_names, strict])    | Class to read CMIP3-like CMOR tables.                                 |
|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [`CMIP5Info`](#esmvalcore.cmor.table.CMIP5Info)(\*[, paths, alt_names, strict])    | Class to read CMIP5-like CMOR tables.                                 |
| [`CMIP6Info`](#esmvalcore.cmor.table.CMIP6Info)(\*[, paths, alt_names, strict])    | Class to read CMIP6-like CMOR tables.                                 |
| [`CoordinateInfo`](#esmvalcore.cmor.table.CoordinateInfo)(name)                         | Class to read and store coordinate information.                       |
| [`InfoBase`](#esmvalcore.cmor.table.InfoBase)(\*[, paths, alt_names, strict])     | Base class for all CMOR table info classes.                           |
| [`JsonInfo`](#esmvalcore.cmor.table.JsonInfo)()                                   | Base class for the info classes.                                      |
| [`NoInfo`](#esmvalcore.cmor.table.NoInfo)()                                     | Table that can be used for projects that do not provide a CMOR table. |
| [`Obs4MIPsInfo`](#esmvalcore.cmor.table.Obs4MIPsInfo)(\*[, paths, alt_names, strict]) | Class to read obs4MIPs-like CMOR tables.                              |
| [`TableInfo`](#esmvalcore.cmor.table.TableInfo)(\*args, \*\*kwargs)                | Container class for storing a CMOR table.                             |
| [`VariableInfo`](#esmvalcore.cmor.table.VariableInfo)([table_type])                   | Class to read and store variable information.                         |

**Data:**

| [`CMOR_TABLES`](#esmvalcore.cmor.table.CMOR_TABLES)   | CMOR info objects.   |
|----------------------------------------------------------------|----------------------|

**Functions:**

| [`clear_table_cache`](#esmvalcore.cmor.table.clear_table_cache)()                           | Clear the CMOR table cache.        |
|------------------------------------------------------------------------------------------------|------------------------------------|
| [`get_tables`](#esmvalcore.cmor.table.get_tables)(session, project)                  | Get the CMOR tables for a project. |
| [`get_var_info`](#esmvalcore.cmor.table.get_var_info)(project, mip, short_name[, ...]) | Get variable information.          |

### *class* esmvalcore.cmor.table.CMIP3Info(, paths: Iterable[Path] = (), alt_names: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, strict: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True)

Bases: [`CMIP5Info`](#esmvalcore.cmor.table.CMIP5Info)

Class to read CMIP3-like CMOR tables.

* **Parameters:**
  * **paths** (*Iterable* *[**Path* *]*) – A list of paths to CMOR tables. The path can be relative to the built-in
    tables in the
    [esmvalcore/cmor/tables](https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables)
    directory, or any other path. The built-in tables will be used if the
    path is relative and exists in the built-in tables directory. Any file
    in the specified paths will be read as a CMOR table.
  * **alt_names** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]*  *|* *None*) – List of known alternative names for variables. If no value is provided,
    the default values from the installed copy of
    [variable_alt_names.yml](https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/cmor/variable_alt_names.yml) will be used.
  * **strict** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – If [`False`](https://docs.python.org/3/builtins/constants.html#False), the function [`get_variable()`](#esmvalcore.cmor.table.InfoBase.get_variable)
    will look for a variable in other tables if it can not be found in the
    table specified by `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset).

**Attributes:**

| [`alt_names`](#esmvalcore.cmor.table.CMIP3Info.alt_names)   | List of known alternative names for variables.                                                    |
|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`coords`](#esmvalcore.cmor.table.CMIP3Info.coords)      | The coordinates defined in these tables.                                                          |
| [`paths`](#esmvalcore.cmor.table.CMIP3Info.paths)       | A list of paths to CMOR tables.                                                                   |
| [`strict`](#esmvalcore.cmor.table.CMIP3Info.strict)      | If False, will look for a variable in other tables if it can not be found in the requested one.   |
| [`tables`](#esmvalcore.cmor.table.CMIP3Info.tables)      | A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects. |

**Methods:**

| [`get_table`](#esmvalcore.cmor.table.CMIP3Info.get_table)(table)                                | Search and return the table info.           |
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [`get_variable`](#esmvalcore.cmor.table.CMIP3Info.get_variable)(table_name, short_name, \*[, ...]) | Search and return the variable information. |

#### alt_names

List of known alternative names for variables.

#### coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

The coordinates defined in these tables.

#### get_table(table: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [TableInfo](#esmvalcore.cmor.table.TableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the table info.

* **Parameters:**
  **table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name
* **Returns:**
  Return the TableInfo object for the requested table if
  found, returns None if not
* **Return type:**
  [*TableInfo*](#esmvalcore.cmor.table.TableInfo) | None

#### get_variable(table_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, derived: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the variable information.

* **Parameters:**
  * **table_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name, i.e., the `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset), e.g. `"Omon"` for CMIP6 or
    `"ocean"` for CMIP7.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name, e.g. `"tos"` for sea surface temperature.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table, e.g. a
    [CMIP7 branding suffix](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Branded_Variables/),
    could be `"tavg-u-hxy-sea"`, which defines the temporal average
    at an undefined vertical level on a horizontal grid where non-sea
    points are masked.
  * **derived** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Variable is derived. Information retrieval for derived variables
    always looks in all tables if variable is not found in the
    requested table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None

#### paths

A list of paths to CMOR tables.

#### strict

If False, will look for a variable in other tables if it can not be
found in the requested one.

#### tables *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [TableInfo](#esmvalcore.cmor.table.TableInfo)]*

A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects.

### *class* esmvalcore.cmor.table.CMIP5Info(, paths: Iterable[Path] = (), alt_names: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, strict: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True)

Bases: [`InfoBase`](#esmvalcore.cmor.table.InfoBase)

Class to read CMIP5-like CMOR tables.

This class reads CMOR 2 format tables.

* **Parameters:**
  * **paths** (*Iterable* *[**Path* *]*) – 

    A list of paths to CMOR tables. The path can be relative to the built-in
    tables in the
    [esmvalcore/cmor/tables](https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables)
    directory, or any other path. The built-in tables will be used if the
    path is relative and exists in the built-in tables directory. Any file
    in the specified paths will be read as a CMOR table.
  * **alt_names** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]*  *|* *None*) – List of known alternative names for variables. If no value is provided,
    the default values from the installed copy of
    [variable_alt_names.yml](https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/cmor/variable_alt_names.yml) will be used.
  * **strict** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – If [`False`](https://docs.python.org/3/builtins/constants.html#False), the function [`get_variable()`](#esmvalcore.cmor.table.InfoBase.get_variable)
    will look for a variable in other tables if it can not be found in the
    table specified by `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset).

**Attributes:**

| [`alt_names`](#esmvalcore.cmor.table.CMIP5Info.alt_names)   | List of known alternative names for variables.                                                    |
|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`coords`](#esmvalcore.cmor.table.CMIP5Info.coords)      | The coordinates defined in these tables.                                                          |
| [`paths`](#esmvalcore.cmor.table.CMIP5Info.paths)       | A list of paths to CMOR tables.                                                                   |
| [`strict`](#esmvalcore.cmor.table.CMIP5Info.strict)      | If False, will look for a variable in other tables if it can not be found in the requested one.   |
| [`tables`](#esmvalcore.cmor.table.CMIP5Info.tables)      | A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects. |

**Methods:**

| [`get_table`](#esmvalcore.cmor.table.CMIP5Info.get_table)(table)                                | Search and return the table info.           |
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [`get_variable`](#esmvalcore.cmor.table.CMIP5Info.get_variable)(table_name, short_name, \*[, ...]) | Search and return the variable information. |

#### alt_names

List of known alternative names for variables.

#### coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

The coordinates defined in these tables.

#### get_table(table: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [TableInfo](#esmvalcore.cmor.table.TableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the table info.

* **Parameters:**
  **table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name
* **Returns:**
  Return the TableInfo object for the requested table if
  found, returns None if not
* **Return type:**
  [*TableInfo*](#esmvalcore.cmor.table.TableInfo) | None

#### get_variable(table_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, derived: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the variable information.

* **Parameters:**
  * **table_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name, i.e., the `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset), e.g. `"Omon"` for CMIP6 or
    `"ocean"` for CMIP7.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name, e.g. `"tos"` for sea surface temperature.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table, e.g. a
    [CMIP7 branding suffix](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Branded_Variables/),
    could be `"tavg-u-hxy-sea"`, which defines the temporal average
    at an undefined vertical level on a horizontal grid where non-sea
    points are masked.
  * **derived** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Variable is derived. Information retrieval for derived variables
    always looks in all tables if variable is not found in the
    requested table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None

#### paths

A list of paths to CMOR tables.

#### strict

If False, will look for a variable in other tables if it can not be
found in the requested one.

#### tables *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [TableInfo](#esmvalcore.cmor.table.TableInfo)]*

A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects.

### *class* esmvalcore.cmor.table.CMIP6Info(, paths: Iterable[Path] = (), alt_names: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, strict: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True)

Bases: [`InfoBase`](#esmvalcore.cmor.table.InfoBase)

Class to read CMIP6-like CMOR tables.

This class reads CMOR 3 json format tables.

* **Parameters:**
  * **paths** (*Iterable* *[**Path* *]*) – 

    A list of paths to CMOR tables. The path can be relative to the built-in
    tables in the
    [esmvalcore/cmor/tables](https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables)
    directory, or any other path. The built-in tables will be used if the
    path is relative and exists in the built-in tables directory. Only files
    with the extension `.json` in the specified paths will be read as a
    CMOR tables, any other files will be ignored.
  * **alt_names** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]*  *|* *None*) – List of known alternative names for variables. If no value is provided,
    the default values from the installed copy of
    [variable_alt_names.yml](https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/cmor/variable_alt_names.yml) will be used.
  * **strict** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – If [`False`](https://docs.python.org/3/builtins/constants.html#False), the function [`get_variable()`](#esmvalcore.cmor.table.InfoBase.get_variable)
    will look for a variable in other tables if it can not be found in the
    table specified by `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset).

**Attributes:**

| [`activities`](#esmvalcore.cmor.table.CMIP6Info.activities)   | A mapping from `exp` to `activity` from the controlled vocabulary.                                |
|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`alt_names`](#esmvalcore.cmor.table.CMIP6Info.alt_names)    | List of known alternative names for variables.                                                    |
| [`coords`](#esmvalcore.cmor.table.CMIP6Info.coords)       | The coordinates defined in these tables.                                                          |
| [`institutes`](#esmvalcore.cmor.table.CMIP6Info.institutes)   | A mapping from `dataset` to `institute` from the controlled vocabulary.                           |
| [`paths`](#esmvalcore.cmor.table.CMIP6Info.paths)        | A list of paths to CMOR tables.                                                                   |
| [`strict`](#esmvalcore.cmor.table.CMIP6Info.strict)       | If False, will look for a variable in other tables if it can not be found in the requested one.   |
| [`tables`](#esmvalcore.cmor.table.CMIP6Info.tables)       | A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects. |

**Methods:**

| [`get_table`](#esmvalcore.cmor.table.CMIP6Info.get_table)(table)                                | Search and return the table info.           |
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [`get_variable`](#esmvalcore.cmor.table.CMIP6Info.get_variable)(table_name, short_name, \*[, ...]) | Search and return the variable information. |

#### activities *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]]*

A mapping from `exp` to `activity` from the controlled vocabulary.

#### alt_names

List of known alternative names for variables.

#### coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

The coordinates defined in these tables.

#### get_table(table: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [TableInfo](#esmvalcore.cmor.table.TableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the table info.

* **Parameters:**
  **table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name
* **Returns:**
  Return the TableInfo object for the requested table if
  found, returns None if not
* **Return type:**
  [*TableInfo*](#esmvalcore.cmor.table.TableInfo) | None

#### get_variable(table_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, derived: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the variable information.

* **Parameters:**
  * **table_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name, i.e., the `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset), e.g. `"Omon"` for CMIP6 or
    `"ocean"` for CMIP7.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name, e.g. `"tos"` for sea surface temperature.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table, e.g. a
    [CMIP7 branding suffix](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Branded_Variables/),
    could be `"tavg-u-hxy-sea"`, which defines the temporal average
    at an undefined vertical level on a horizontal grid where non-sea
    points are masked.
  * **derived** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Variable is derived. Information retrieval for derived variables
    always looks in all tables if variable is not found in the
    requested table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None

#### institutes *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]]*

A mapping from `dataset` to `institute` from the controlled vocabulary.

#### paths

A list of paths to CMOR tables.

#### strict

If False, will look for a variable in other tables if it can not be
found in the requested one.

#### tables *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [TableInfo](#esmvalcore.cmor.table.TableInfo)]*

A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects.

#### var_to_freq *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]]*

### esmvalcore.cmor.table.CMOR_TABLES *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [InfoBase](#esmvalcore.cmor.table.InfoBase)]* *= {'ACCESS': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CESM': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CMIP3': CMIP3Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip3/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip3-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CMIP5': CMIP5Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CMIP6': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CMIP6Plus': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6plus/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CMIP7': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip7/tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CORDEX': CMIP5Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cordex/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cordex-custom'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'CORDEX-CMIP6': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cordex-cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cordex-cmip6-custom'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=True, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'EMAC': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'ICON': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'IPSLCM': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'OBS': CMIP5Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'OBS6': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'ana4MIPs': CMIP5Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip5-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'native6': CMIP6Info(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']]), 'obs4MIPs': Obs4MIPsInfo(paths=[PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/obs4mips/Tables'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/esmvalcore/checkouts/3124/esmvalcore/cmor/tables/cmip6-custom')], strict=False, alt_names=[['sic', 'siconc'], ['tro3', 'o3'], ['usi', 'siu'], ['vsi', 'siv']])}*

CMOR info objects.

#### Deprecated
Deprecated since version 2.14.0: The global `CMOR_TABLES` dictionary is deprecated and will be removed in
ESMValCore v2.16.0. Please use [`get_tables()`](#esmvalcore.cmor.table.get_tables)
to access the CMOR tables instead.

#### NOTE
If this dictionary is empty, it can be populated by loading the global
configuration by importing the [`esmvalcore.config`](esmvalcore.config.html.md#module-esmvalcore.config) module.

* **Type:**
  [dict](https://docs.python.org/3/builtins/stdtypes.html#dict) of [str](https://docs.python.org/3/builtins/stdtypes.html#str), obj

### *class* esmvalcore.cmor.table.CoordinateInfo(name: [str](https://docs.python.org/3/builtins/stdtypes.html#str))

Bases: [`JsonInfo`](#esmvalcore.cmor.table.JsonInfo)

Class to read and store coordinate information.

**Attributes:**

| [`axis`](#esmvalcore.cmor.table.CoordinateInfo.axis)             | Axis                                            |
|-------------------------------------------------------------------|-------------------------------------------------|
| [`generic_lev_name`](#esmvalcore.cmor.table.CoordinateInfo.generic_lev_name) | Generic level name                              |
| [`long_name`](#esmvalcore.cmor.table.CoordinateInfo.long_name)        | Long name                                       |
| [`must_have_bounds`](#esmvalcore.cmor.table.CoordinateInfo.must_have_bounds) | Whether bounds are required on this dimension   |
| [`name`](#esmvalcore.cmor.table.CoordinateInfo.name)             | Name of the coordinate entry in the CMOR table. |
| [`out_name`](#esmvalcore.cmor.table.CoordinateInfo.out_name)         | Out name                                        |
| [`requested`](#esmvalcore.cmor.table.CoordinateInfo.requested)        | Values requested                                |
| [`standard_name`](#esmvalcore.cmor.table.CoordinateInfo.standard_name)    | Standard name                                   |
| [`stored_direction`](#esmvalcore.cmor.table.CoordinateInfo.stored_direction) | Direction in which the coordinate increases     |
| [`units`](#esmvalcore.cmor.table.CoordinateInfo.units)            | Units                                           |
| [`valid_max`](#esmvalcore.cmor.table.CoordinateInfo.valid_max)        | Maximum allowed value                           |
| [`valid_min`](#esmvalcore.cmor.table.CoordinateInfo.valid_min)        | Minimum allowed value                           |
| [`value`](#esmvalcore.cmor.table.CoordinateInfo.value)            | Coordinate value                                |
| [`var_name`](#esmvalcore.cmor.table.CoordinateInfo.var_name)         | Short name                                      |

**Methods:**

| [`read_json`](#esmvalcore.cmor.table.CoordinateInfo.read_json)(json_data)   | Read coordinate information from json.   |
|-------------------------------------------------------------------------|------------------------------------------|
* **Parameters:**
  **name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str))

#### axis

Axis

#### generic_lev_coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

#### generic_lev_name

Generic level name

#### long_name

Long name

#### must_have_bounds

Whether bounds are required on this dimension

#### name

Name of the coordinate entry in the CMOR table.

#### out_name

Out name

This is the name of the variable in the file

#### read_json(json_data)

Read coordinate information from json.

Non-present options will be set to empty

* **Parameters:**
  **json_data** ([*dict*](https://docs.python.org/3/builtins/stdtypes.html#dict)) – dictionary created by the json reader containing
  coordinate information

#### requested *: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]*

Values requested

#### standard_name

Standard name

#### stored_direction

Direction in which the coordinate increases

#### units

Units

#### valid_max

Maximum allowed value

#### valid_min

Minimum allowed value

#### value

Coordinate value

#### var_name

Short name

### *class* esmvalcore.cmor.table.InfoBase(, paths: Iterable[Path] = (), alt_names: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, strict: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Base class for all CMOR table info classes.

* **Parameters:**
  * **paths** (*Iterable* *[**Path* *]*) – 

    A list of paths to CMOR tables. The path can be relative to the built-in
    tables in the
    [esmvalcore/cmor/tables](https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables)
    directory, or any other path. The built-in tables will be used if the
    path is relative and exists in the built-in tables directory.
  * **alt_names** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]*  *|* *None*) – List of known alternative names for variables. If no value is provided,
    the default values from the installed copy of
    [variable_alt_names.yml](https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/cmor/variable_alt_names.yml)
    will be used.
  * **strict** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – If [`False`](https://docs.python.org/3/builtins/constants.html#False), the function [`get_variable()`](#esmvalcore.cmor.table.InfoBase.get_variable)
    will look for a variable in other tables if it can not be found in the
    table specified by `mip` in the [recipe](../recipe/index.html.md#recipe) or [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset).

**Attributes:**

| [`alt_names`](#esmvalcore.cmor.table.InfoBase.alt_names)   | List of known alternative names for variables.                                                    |
|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`coords`](#esmvalcore.cmor.table.InfoBase.coords)      | The coordinates defined in these tables.                                                          |
| [`paths`](#esmvalcore.cmor.table.InfoBase.paths)       | A list of paths to CMOR tables.                                                                   |
| [`strict`](#esmvalcore.cmor.table.InfoBase.strict)      | If False, will look for a variable in other tables if it can not be found in the requested one.   |
| [`tables`](#esmvalcore.cmor.table.InfoBase.tables)      | A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects. |

**Methods:**

| [`get_table`](#esmvalcore.cmor.table.InfoBase.get_table)(table)                                | Search and return the table info.           |
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [`get_variable`](#esmvalcore.cmor.table.InfoBase.get_variable)(table_name, short_name, \*[, ...]) | Search and return the variable information. |

#### alt_names

List of known alternative names for variables.

#### coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

The coordinates defined in these tables.

#### get_table(table: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [TableInfo](#esmvalcore.cmor.table.TableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the table info.

* **Parameters:**
  **table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name
* **Returns:**
  Return the TableInfo object for the requested table if
  found, returns None if not
* **Return type:**
  [TableInfo](#esmvalcore.cmor.table.TableInfo)

#### get_variable(table_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, derived: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the variable information.

* **Parameters:**
  * **table_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name, i.e., the `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset), e.g. `"Omon"` for CMIP6 or
    `"ocean"` for CMIP7.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name, e.g. `"tos"` for sea surface temperature.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table, e.g. a
    [CMIP7 branding suffix](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Branded_Variables/),
    could be `"tavg-u-hxy-sea"`, which defines the temporal average
    at an undefined vertical level on a horizontal grid where non-sea
    points are masked.
  * **derived** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Variable is derived. Information retrieval for derived variables
    always looks in all tables if variable is not found in the
    requested table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None

#### paths

A list of paths to CMOR tables.

#### strict

If False, will look for a variable in other tables if it can not be
found in the requested one.

#### tables *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [TableInfo](#esmvalcore.cmor.table.TableInfo)]*

A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects.

### *class* esmvalcore.cmor.table.JsonInfo

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Base class for the info classes.

Provides common utility methods to read json variables

### *class* esmvalcore.cmor.table.NoInfo

Bases: [`InfoBase`](#esmvalcore.cmor.table.InfoBase)

Table that can be used for projects that do not provide a CMOR table.

**Attributes:**

| [`alt_names`](#esmvalcore.cmor.table.NoInfo.alt_names)   | List of known alternative names for variables.                                                    |
|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`coords`](#esmvalcore.cmor.table.NoInfo.coords)      | The coordinates defined in these tables.                                                          |
| [`paths`](#esmvalcore.cmor.table.NoInfo.paths)       | A list of paths to CMOR tables.                                                                   |
| [`strict`](#esmvalcore.cmor.table.NoInfo.strict)      | If False, will look for a variable in other tables if it can not be found in the requested one.   |
| [`tables`](#esmvalcore.cmor.table.NoInfo.tables)      | A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects. |

**Methods:**

| [`get_table`](#esmvalcore.cmor.table.NoInfo.get_table)(table)                                | Search and return the table info.           |
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [`get_variable`](#esmvalcore.cmor.table.NoInfo.get_variable)(table_name, short_name, \*[, ...]) | Search and return the variable information. |

#### alt_names

List of known alternative names for variables.

#### coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

The coordinates defined in these tables.

#### get_table(table: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [TableInfo](#esmvalcore.cmor.table.TableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the table info.

* **Parameters:**
  **table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name
* **Returns:**
  Return the TableInfo object for the requested table if
  found, returns None if not
* **Return type:**
  [TableInfo](#esmvalcore.cmor.table.TableInfo)

#### get_variable(table_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, derived: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the variable information.

* **Parameters:**
  * **table_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name, i.e., the `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset), e.g. `"Omon"` for CMIP6 or
    `"ocean"` for CMIP7.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name, e.g. `"tos"` for sea surface temperature.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table, e.g. a
    [CMIP7 branding suffix](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Branded_Variables/),
    could be `"tavg-u-hxy-sea"`, which defines the temporal average
    at an undefined vertical level on a horizontal grid where non-sea
    points are masked.
  * **derived** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Variable is derived. Information retrieval for derived variables
    always looks in all tables if variable is not found in the
    requested table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None

#### paths

A list of paths to CMOR tables.

#### strict

If False, will look for a variable in other tables if it can not be
found in the requested one.

#### tables *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [TableInfo](#esmvalcore.cmor.table.TableInfo)]*

A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects.

### *class* esmvalcore.cmor.table.Obs4MIPsInfo(, paths: Iterable[Path] = (), alt_names: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, strict: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True)

Bases: [`CMIP6Info`](#esmvalcore.cmor.table.CMIP6Info)

Class to read obs4MIPs-like CMOR tables.

* **Parameters:**
  * **paths** (*Iterable* *[**Path* *]*) – 

    A list of paths to CMOR tables. The path can be relative to the built-in
    tables in the
    [esmvalcore/cmor/tables](https://github.com/ESMValGroup/ESMValCore/tree/main/esmvalcore/cmor/tables)
    directory, or any other path. The built-in tables will be used if the
    path is relative and exists in the built-in tables directory.
  * **alt_names** ([*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*list*](https://docs.python.org/3/builtins/stdtypes.html#list) *[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *]* *]*  *|* *None*) – List of known alternative names for variables. If no value is provided,
    the default values from the installed copy of
    [variable_alt_names.yml](https://github.com/ESMValGroup/ESMValCore/blob/main/esmvalcore/cmor/variable_alt_names.yml) will be used.
  * **strict** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – If [`False`](https://docs.python.org/3/builtins/constants.html#False), the function [`get_variable()`](#esmvalcore.cmor.table.InfoBase.get_variable)
    will look for a variable in other tables if it can not be found in the
    table specified by `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset).

**Attributes:**

| [`activities`](#esmvalcore.cmor.table.Obs4MIPsInfo.activities)   | A mapping from `exp` to `activity` from the controlled vocabulary.                                |
|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| [`alt_names`](#esmvalcore.cmor.table.Obs4MIPsInfo.alt_names)    | List of known alternative names for variables.                                                    |
| [`coords`](#esmvalcore.cmor.table.Obs4MIPsInfo.coords)       | The coordinates defined in these tables.                                                          |
| [`institutes`](#esmvalcore.cmor.table.Obs4MIPsInfo.institutes)   | A mapping from `dataset` to `institute` from the controlled vocabulary.                           |
| [`paths`](#esmvalcore.cmor.table.Obs4MIPsInfo.paths)        | A list of paths to CMOR tables.                                                                   |
| [`strict`](#esmvalcore.cmor.table.Obs4MIPsInfo.strict)       | If False, will look for a variable in other tables if it can not be found in the requested one.   |
| [`tables`](#esmvalcore.cmor.table.Obs4MIPsInfo.tables)       | A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects. |
| [`var_to_freq`](#esmvalcore.cmor.table.Obs4MIPsInfo.var_to_freq)  |                                                                                                   |

**Methods:**

| [`get_table`](#esmvalcore.cmor.table.Obs4MIPsInfo.get_table)(table)                                | Search and return the table info.           |
|--------------------------------------------------------------------------------------------------|---------------------------------------------|
| [`get_variable`](#esmvalcore.cmor.table.Obs4MIPsInfo.get_variable)(table_name, short_name, \*[, ...]) | Search and return the variable information. |

#### activities *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]]*

A mapping from `exp` to `activity` from the controlled vocabulary.

#### alt_names

List of known alternative names for variables.

#### coords *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

The coordinates defined in these tables.

#### get_table(table: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [TableInfo](#esmvalcore.cmor.table.TableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the table info.

* **Parameters:**
  **table** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name
* **Returns:**
  Return the TableInfo object for the requested table if
  found, returns None if not
* **Return type:**
  [*TableInfo*](#esmvalcore.cmor.table.TableInfo) | None

#### get_variable(table_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), , branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, derived: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Search and return the variable information.

* **Parameters:**
  * **table_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Table name, i.e., the `mip` in the [recipe](../recipe/index.html.md#recipe) or
    [`Dataset`](esmvalcore.dataset.html.md#esmvalcore.dataset.Dataset), e.g. `"Omon"` for CMIP6 or
    `"ocean"` for CMIP7.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name, e.g. `"tos"` for sea surface temperature.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table, e.g. a
    [CMIP7 branding suffix](https://wcrp-cmip.github.io/cmip7-guidance/docs/CMIP7/Branded_Variables/),
    could be `"tavg-u-hxy-sea"`, which defines the temporal average
    at an undefined vertical level on a horizontal grid where non-sea
    points are masked.
  * **derived** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool)) – Variable is derived. Information retrieval for derived variables
    always looks in all tables if variable is not found in the
    requested table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None

#### institutes *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]]*

A mapping from `dataset` to `institute` from the controlled vocabulary.

#### paths

A list of paths to CMOR tables.

#### strict

If False, will look for a variable in other tables if it can not be
found in the requested one.

#### tables *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [TableInfo](#esmvalcore.cmor.table.TableInfo)]*

A mapping from table names to [`TableInfo`](#esmvalcore.cmor.table.TableInfo) objects.

#### var_to_freq *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)]]*

### *class* esmvalcore.cmor.table.TableInfo(\*args, \*\*kwargs)

Bases: [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

Container class for storing a CMOR table.

**Methods:**

| [`clear`](#esmvalcore.cmor.table.TableInfo.clear)()                     | Remove all items from the dict.                                                                                                                                                                                                    |
|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`copy`](#esmvalcore.cmor.table.TableInfo.copy)()                      | Return a shallow copy of the dict.                                                                                                                                                                                                 |
| [`fromkeys`](#esmvalcore.cmor.table.TableInfo.fromkeys)(iterable[, value]) | Create a new dictionary with keys from iterable and values set to value.                                                                                                                                                           |
| [`get`](#esmvalcore.cmor.table.TableInfo.get)(key[, default])         | Return the value for key if key is in the dictionary, else default.                                                                                                                                                                |
| [`items`](#esmvalcore.cmor.table.TableInfo.items)()                     | Return a set-like object providing a view on the dict's items.                                                                                                                                                                     |
| [`keys`](#esmvalcore.cmor.table.TableInfo.keys)()                      | Return a set-like object providing a view on the dict's keys.                                                                                                                                                                      |
| [`pop`](#esmvalcore.cmor.table.TableInfo.pop)(k[,d])                  | If the key is not found, return the default if given; otherwise, raise a KeyError.                                                                                                                                                 |
| [`popitem`](#esmvalcore.cmor.table.TableInfo.popitem)()                   | Remove and return a (key, value) pair as a 2-tuple.                                                                                                                                                                                |
| [`setdefault`](#esmvalcore.cmor.table.TableInfo.setdefault)(key[, default])  | Insert key with a value of default if key is not in the dictionary.                                                                                                                                                                |
| [`update`](#esmvalcore.cmor.table.TableInfo.update)([E, ]\*\*F)          | If E is present and has a .keys() method, then does:  for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v In either case, this is followed by: for k in F:  D[k] = F[k] |
| [`values`](#esmvalcore.cmor.table.TableInfo.values)()                    | Return an object providing a view on the dict's values.                                                                                                                                                                            |

**Attributes:**

| [`frequency`](#esmvalcore.cmor.table.TableInfo.frequency)   | Table frequency (if defined).   |
|--------------------------------------------------------------|---------------------------------|
| [`name`](#esmvalcore.cmor.table.TableInfo.name)        | Table name.                     |
| [`realm`](#esmvalcore.cmor.table.TableInfo.realm)       | Table realm (if defined).       |

#### clear()

Remove all items from the dict.

#### copy()

Return a shallow copy of the dict.

#### frequency

Table frequency (if defined).

#### *classmethod* fromkeys(iterable, value=None,)

Create a new dictionary with keys from iterable and values set to value.

#### get(key, default=None,)

Return the value for key if key is in the dictionary, else default.

#### items()

Return a set-like object providing a view on the dict’s items.

#### keys()

Return a set-like object providing a view on the dict’s keys.

#### name

Table name.

#### pop(k) → v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise,
raise a KeyError.

#### popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.

#### realm

Table realm (if defined).

#### setdefault(key, default=None,)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

#### update(\*\*F) → None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does:  for k in E.keys(): D[k] = E[k]
If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
In either case, this is followed by: for k in F:  D[k] = F[k]

#### values()

Return an object providing a view on the dict’s values.

### *class* esmvalcore.cmor.table.VariableInfo(table_type: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = '')

Bases: [`JsonInfo`](#esmvalcore.cmor.table.JsonInfo)

Class to read and store variable information.

**Attributes:**

| [`coordinates`](#esmvalcore.cmor.table.VariableInfo.coordinates)    | Coordinates            |
|-----------------------------------------------------------------|------------------------|
| [`dimensions`](#esmvalcore.cmor.table.VariableInfo.dimensions)     | List of dimensions     |
| [`frequency`](#esmvalcore.cmor.table.VariableInfo.frequency)      | Data frequency         |
| [`long_name`](#esmvalcore.cmor.table.VariableInfo.long_name)      | Long name              |
| [`modeling_realm`](#esmvalcore.cmor.table.VariableInfo.modeling_realm) | Modeling realm         |
| [`positive`](#esmvalcore.cmor.table.VariableInfo.positive)       | Increasing direction   |
| [`short_name`](#esmvalcore.cmor.table.VariableInfo.short_name)     | Short name             |
| [`standard_name`](#esmvalcore.cmor.table.VariableInfo.standard_name)  | Standard name          |
| [`units`](#esmvalcore.cmor.table.VariableInfo.units)          | Data units             |
| [`valid_max`](#esmvalcore.cmor.table.VariableInfo.valid_max)      | Maximum admitted value |
| [`valid_min`](#esmvalcore.cmor.table.VariableInfo.valid_min)      | Minimum admitted value |

**Methods:**

| [`copy`](#esmvalcore.cmor.table.VariableInfo.copy)()                                      | Return a shallow copy of VariableInfo.                   |
|----------------------------------------------------------------------------------------------|----------------------------------------------------------|
| [`has_coord_with_standard_name`](#esmvalcore.cmor.table.VariableInfo.has_coord_with_standard_name)(standard_name) | Check if a coordinate with a given standard_name exists. |
| [`read_json`](#esmvalcore.cmor.table.VariableInfo.read_json)(json_data, default_freq)          | Read variable information from json.                     |
* **Parameters:**
  **table_type** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str))

#### coordinates *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [CoordinateInfo](#esmvalcore.cmor.table.CoordinateInfo)]*

Coordinates

This is a dict with the names of the dimensions as keys and
CoordinateInfo objects as values.

#### copy() → [Self](https://docs.python.org/3/library/typing.html#typing.Self)

Return a shallow copy of VariableInfo.

* **Returns:**
  Shallow copy of this object.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo)

#### dimensions *: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]*

List of dimensions

#### frequency

Data frequency

#### has_coord_with_standard_name(standard_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [bool](https://docs.python.org/3/builtins/functions.html#bool)

Check if a coordinate with a given standard_name exists.

For some coordinates, multiple (slightly different) versions with
different dimension names but identical standard_name exist. For
example, the CMIP6 tables provide 4 different standard_name=time
dimensions: time, time1, time2, and time3. Other examples would
be the CMIP6 pressure levels (plev19, plev23, plev27, etc.  with
standard name air_pressure) and the altitudes (alt16, alt40 with
standard name altitude).

This function can be used to check for the existence of a specific
coordinate defined by its standard_name, not its dimension name.

* **Parameters:**
  **standard_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Standard name to be checked.
* **Returns:**
  True if there is at least one coordinate with the given
  standard_name, False if not.
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

#### long_name

Long name

#### modeling_realm *: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]*

Modeling realm

#### positive

Increasing direction

#### read_json(json_data: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict), default_freq: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [None](https://docs.python.org/3/builtins/constants.html#None)

Read variable information from json.

Non-present options will be set to empty

* **Parameters:**
  * **json_data** ([*dict*](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Dictionary created by the json reader containing variable
    information.
  * **default_freq** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Default frequency to use if it is not defined at variable level.
* **Return type:**
  None

#### short_name

Short name

#### standard_name

Standard name

#### units

Data units

#### valid_max

Maximum admitted value

#### valid_min

Minimum admitted value

### esmvalcore.cmor.table.clear_table_cache() → [None](https://docs.python.org/3/builtins/constants.html#None)

Clear the CMOR table cache.

* **Return type:**
  None

### esmvalcore.cmor.table.get_tables(session: [Session](esmvalcore.config.html.md#esmvalcore.config.Session) | [Config](esmvalcore.config.html.md#esmvalcore.config.Config), project: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [InfoBase](#esmvalcore.cmor.table.InfoBase)

Get the CMOR tables for a project.

* **Parameters:**
  * **session** ([*Session*](esmvalcore.config.html.md#esmvalcore.config.Session) *|* [*Config*](esmvalcore.config.html.md#esmvalcore.config.Config)) – The configuration.
  * **project** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – The project to load a CMOR table for.
* **Return type:**
  [InfoBase](#esmvalcore.cmor.table.InfoBase)

### esmvalcore.cmor.table.get_var_info(project: [str](https://docs.python.org/3/builtins/stdtypes.html#str), mip: [str](https://docs.python.org/3/builtins/stdtypes.html#str), short_name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), branding_suffix: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None) → [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | [None](https://docs.python.org/3/builtins/constants.html#None)

Get variable information.

#### NOTE
If project=CORDEX and the mip ends with ‘hr’, it is cropped to ‘h’
since CORDEX X-hourly tables define the mip as ending in ‘h’ instead of
‘hr’.

* **Parameters:**
  * **project** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Dataset’s project.
  * **mip** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s CMOR table, i.e., MIP.
  * **short_name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Variable’s short name.
  * **branding_suffix** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *|* *None*) – A suffix that will be appended to `short_name` when looking up the
    variable in the CMOR table.
* **Returns:**
  VariableInfo object for the requested variable if found, `None`
  otherwise.
* **Return type:**
  [VariableInfo](#esmvalcore.cmor.table.VariableInfo) | None
* **Raises:**
  [**KeyError**](https://docs.python.org/3/builtins/exceptions.html#KeyError) – No CMOR tables available for project.
