<a id="api-recipe-metadata"></a>

# Recipe Metadata

This section describes the [`recipe_metadata`](#module-esmvalcore.experimental.recipe_metadata) submodule of the API (`esmvalcore.experimental`).

## API reference

API for recipe metadata.

**Classes:**

| [`Contributor`](#esmvalcore.experimental.recipe_metadata.Contributor)(name, institute[, orcid])   | Contains contributor (author or maintainer) information.            |
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [`Project`](#esmvalcore.experimental.recipe_metadata.Project)(project)                        | Use this class to acknowledge a project associated with the recipe. |
| [`Reference`](#esmvalcore.experimental.recipe_metadata.Reference)(filename)                     | Parse reference information from bibtex entries.                    |

**Exceptions:**

| [`RenderError`](#esmvalcore.experimental.recipe_metadata.RenderError)   | Error during rendering of object.   |
|----------------------------------------------------------------|-------------------------------------|

### *class* esmvalcore.experimental.recipe_metadata.Contributor(name: [str](https://docs.python.org/3/builtins/stdtypes.html#str), institute: [str](https://docs.python.org/3/builtins/stdtypes.html#str), orcid: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None)

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

Contains contributor (author or maintainer) information.

* **Parameters:**
  * **name** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the author, i.e. `'John Doe'`
  * **institute** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the institute
  * **orcid** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str) *,* *optional*) – ORCID url

**Methods:**

| [`from_dict`](#esmvalcore.experimental.recipe_metadata.Contributor.from_dict)(attributes)   | Return an instance of Contributor from a dictionary.   |
|--------------------------------------------------------------------------|--------------------------------------------------------|
| [`from_tag`](#esmvalcore.experimental.recipe_metadata.Contributor.from_tag)(tag)           | Return an instance of Contributor from a tag (`TAGS`). |

#### *classmethod* from_dict(attributes)

Return an instance of Contributor from a dictionary.

* **Parameters:**
  **attributes** ([*dict*](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Dictionary containing name / institute [/ orcid].

#### *classmethod* from_tag(tag: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [Contributor](#esmvalcore.experimental.recipe_metadata.Contributor)

Return an instance of Contributor from a tag (`TAGS`).

* **Parameters:**
  **tag** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – The contributor tags are defined in the authors section in
  `config-references.yml`.
* **Return type:**
  [*Contributor*](#esmvalcore.experimental.recipe_metadata.Contributor)

### *class* esmvalcore.experimental.recipe_metadata.Project(project: [str](https://docs.python.org/3/builtins/stdtypes.html#str))

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

Use this class to acknowledge a project associated with the recipe.

* **Parameters:**
  **project** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – The project title.

**Methods:**

| [`from_tag`](#esmvalcore.experimental.recipe_metadata.Project.from_tag)(tag)   | Return an instance of Project from a tag (`TAGS`).   |
|------------------------------------------------------------------|------------------------------------------------------|

#### *classmethod* from_tag(tag: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [Project](#esmvalcore.experimental.recipe_metadata.Project)

Return an instance of Project from a tag (`TAGS`).

* **Parameters:**
  **tag** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – The project tags are defined in `config-references.yml`.
* **Return type:**
  [*Project*](#esmvalcore.experimental.recipe_metadata.Project)

### *class* esmvalcore.experimental.recipe_metadata.Reference(filename: [str](https://docs.python.org/3/builtins/stdtypes.html#str))

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

Parse reference information from bibtex entries.

* **Parameters:**
  **filename** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the bibtex file.
* **Raises:**
  [**NotImplementedError**](https://docs.python.org/3/builtins/exceptions.html#NotImplementedError) – If the bibtex file contains more than 1 entry.

**Methods:**

| [`from_tag`](#esmvalcore.experimental.recipe_metadata.Reference.from_tag)(tag)      | Return an instance of Reference from a bibtex tag.   |
|---------------------------------------------------------------------|------------------------------------------------------|
| [`render`](#esmvalcore.experimental.recipe_metadata.Reference.render)([renderer]) | Render the reference.                                |

#### *classmethod* from_tag(tag: [str](https://docs.python.org/3/builtins/stdtypes.html#str)) → [Reference](#esmvalcore.experimental.recipe_metadata.Reference)

Return an instance of Reference from a bibtex tag.

* **Parameters:**
  **tag** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – The bibtex tags resolved as `esmvaltool/references/{tag}.bibtex`
  or the corresponding directory as defined by the diagnostics path.
* **Return type:**
  [*Reference*](#esmvalcore.experimental.recipe_metadata.Reference)

#### render(renderer: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'html') → [str](https://docs.python.org/3/builtins/stdtypes.html#str)

Render the reference.

* **Parameters:**
  **renderer** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Choose the renderer for the string representation.
  Must be one of: ‘plaintext’, ‘markdown’, ‘html’, ‘latex’
* **Returns:**
  Rendered reference
* **Return type:**
  [str](https://docs.python.org/3/builtins/stdtypes.html#str)

### *exception* esmvalcore.experimental.recipe_metadata.RenderError

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

Error during rendering of object.

**Methods:**

| [`add_note`](#esmvalcore.experimental.recipe_metadata.RenderError.add_note)(note, /)     | Add a note to the exception                     |
|------------------------------------------------------------------------|-------------------------------------------------|
| [`with_traceback`](#esmvalcore.experimental.recipe_metadata.RenderError.with_traceback)(tb, /) | Set self._\_traceback_\_ to tb and return self. |

**Attributes:**

| [`args`](#esmvalcore.experimental.recipe_metadata.RenderError.args)   |    |
|---------------------------------------------------------|----|

#### add_note(note,)

Add a note to the exception

#### args

#### with_traceback(tb,)

Set self._\_traceback_\_ to tb and return self.
