diagnostic.diagnostic.Diagnostic#
- class Diagnostic(diagnostic_function, plotting_function, name=None, description=None)[source]#
Bases:
objectAn abstract class representing a diagnostic.
- __init__(diagnostic_function, plotting_function, name=None, description=None)[source]#
Initialize the Diagnostic.
- Parameters:
diagnostic_function – The function that applies a diagnostic to the data.
plotting_function – The function that visualizes the results of the diagnostic.
name (str) – The name of the diagnostic.
description (str) – The description of the diagnostic.
Methods
__init__(diagnostic_function, plotting_function)Initialize the Diagnostic.
apply(data)Apply the diagnostic to the data.
plot(result[, title])Plot the diagnostic.
Attributes
Generate the docstring for the diagnostic.
- abstract apply(data)[source]#
Apply the diagnostic to the data.
- Parameters:
data – The data to apply the diagnostic to. Data can be an xarray DataTree, Dataset or DataArray.
- Returns:
The data after applying the diagnostic either as a DataTree, Dataset, DataArray, Scalar, or a pandas DataFrame.
- Return type:
Results
- property description#
Generate the docstring for the diagnostic.
- plot(result, title=None, **kwargs)[source]#
Plot the diagnostic. Single ax plots.
- Parameters:
result (xr.Dataset or xr.DataArray or DataTree) – The output of the diagnostic function.
title (str) – The title of the plot.
**kwargs – Keyword arguments to pass to the plotting function.
- Returns:
ax – The axis (singular) of the plot.
- Return type:
matplotlib.axis.Axis