<a id="api-esmvaltool-diag-scripts-monitor-monitor-base"></a>

# Base class for monitoring diagnostics

Base class for monitoring diagnostics.

**Classes:**

| [`MonitorBase`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase)(config)   | Base class for monitoring diagnostic.   |
|------------------------------------------------------------------------|-----------------------------------------|

### *class* esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase(config)

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

Base class for monitoring diagnostic.

It contains the common methods for path creation, provenance
recording, option parsing and to create some common plots.

**Methods:**

| [`get_plot_folder`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.get_plot_folder)(var_info)                         | Get plot storage folder from variable info.                 |
|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [`get_plot_name`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.get_plot_name)(plot_type, var_info[, add_ext])     | Get plot filename from variable info.                       |
| [`get_plot_path`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.get_plot_path)(plot_type, var_info[, add_ext])     | Get plot full path from variable info.                      |
| [`get_provenance_record`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.get_provenance_record)(ancestor_files, \*\*kwargs) | Create provenance record for the diagnostic data and plots. |
| [`plot_cube`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.plot_cube)(cube, filename[, linestyle])            | Plot a timeseries from a cube.                              |
| [`plot_timeseries`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.plot_timeseries)(cube, var_info[, period])         | Plot timeseries from a cube.                                |
| [`record_plot_provenance`](#esmvaltool.diag_scripts.monitor.monitor_base.MonitorBase.record_plot_provenance)(filename, var_info, ...)   | Write provenance info for a given file.                     |

#### get_plot_folder(var_info)

Get plot storage folder from variable info.

* **Parameters:**
  **var_info** ([*dict*](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Variable information from ESMValTool

#### get_plot_name(plot_type, var_info, add_ext=True)

Get plot filename from variable info.

* **Parameters:**
  * **plot_type** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the plot
  * **var_info** ([*dict*](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Variable information from ESMValTool
  * **add_ext** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool) *,* *optional* *(**default: True* *)*) – Add filename extension from configuration file.

#### get_plot_path(plot_type, var_info, add_ext=True)

Get plot full path from variable info.

* **Parameters:**
  * **plot_type** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of the plot
  * **var_info** ([*dict*](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Variable information from ESMValTool
  * **add_ext** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool) *,* *optional* *(**default: True* *)*) – Add filename extension from configuration file.

#### *static* get_provenance_record(ancestor_files, \*\*kwargs)

Create provenance record for the diagnostic data and plots.

#### plot_cube(cube, filename, linestyle='-', \*\*kwargs)

Plot a timeseries from a cube.

Supports multiplot layouts for cubes with extra dimensions
shape_id or region.

#### plot_timeseries(cube, var_info, period='', \*\*kwargs)

Plot timeseries from a cube.

It also automatically smoothes it for long timeseries of monthly data:
: - Between 10 and 70 years long, it also plots the 12-month rolling
    average along the raw series
  - For more than ten years, it plots the 12-month and 10-years
    rolling averages and not the raw series

#### record_plot_provenance(filename, var_info, plot_type, \*\*kwargs)

Write provenance info for a given file.
