src.plot#

Module Contents#

Classes#

MidpointNormalize

Midpoint normalised colorbar norm

Functions#

hindcasts(hcsts[, obsvs, hists, shade, ax, figsize])

Plot sets of hindcasts. Where multiple variables are provided, it is

metric_maps(fields, variable, vrange[, headings, ...])

Plot panels of skill score maps

metrics(metrics, variable[, headings, one_legend, ...])

Plot panels of skill scores. When multiple metrics are provided in a panel,

Attributes#

PROJECT_DIR

src.plot.PROJECT_DIR#
class src.plot.MidpointNormalize(vmin=None, vmax=None, midpoint=None, clip=False)#

Bases: matplotlib.colors.Normalize

Midpoint normalised colorbar norm

__call__(value, clip=None)#

Normalize value data in the [vmin, vmax] interval into the [0.0, 1.0] interval and return it.

Parameters
value

Data to normalize.

clipbool

If None, defaults to self.clip (which defaults to False).

Notes

If not already initialized, self.vmin and self.vmax are initialized using self.autoscale_None(value).

src.plot.hindcasts(hcsts, obsvs=None, hists=None, shade=False, ax=None, figsize=(15, 4))#

Plot sets of hindcasts. Where multiple variables are provided, it is assumed that all inputs contain the same variables.

Parameters
hcstsdict

Dictionary of hindcasts to plot with the format {“name”: hcst}, where hcst is an xarray.Dataset with dimensions “init” and “lead”

obsvsdict, optional

Dictionary of observations to plot with the format {“name”: obsv}, where obsv is an xarray.Dataset with dimension “time”

histdict, optional

Dictionary of historical runs to plot with the format {“name”: hist}, where hist is an xarray.Dataset with dimension “time”

shadebool, optional

If True, shade background according to change in bias correction in CAFE60v1

src.plot.metric_maps(fields, variable, vrange, headings=None, add_colorbar=True, cbar_bounds=None, cmap='PiYG', central_longitude=180, figsize=(15, 15))#

Plot panels of skill score maps

Parameters
fieldslist

List of size n_rows x n_columns containing the fields to plot

variablestr

The name of the variable

vrangeiterable of length 2

The vmin and vmax values for all panels

headingslist

List of the same size as fields containing the headins for each panel

figsizeiterable of length 2

The total size of the figure

src.plot.metrics(metrics, variable, headings=None, one_legend=True, shade_background=True, figsize=(15, 15))#

Plot panels of skill scores. When multiple metrics are provided in a panel, cross are shown along the x-axis where both metrics are positive.

Parameters
metricslist

List of size n_rows x n_columns containing dictionaries of the model metrics to plot in each panel, e.g. [[{“model1”: {“rXY”: metric1, “ri”: metric2}, “model2”: {“rXY”: metric1, “ri”: metric2}}]]

variablestr

The name of the variable

headingslist

List of the same size as fields containing the headins for each panel

one_legendboolean, optional

If True, only add a legend to the first panel

shade_backgroundboolean, optional

Of True, shade the background either side of zero

figsizeiterable of length 2

The total size of the figure