marEx.plotX.base.PlotterBase

class marEx.plotX.base.PlotterBase(xarray_obj, dimensions=None, coordinates=None)[source]

Bases: object

Base class for all plotters providing common functionality.

This class provides the core infrastructure for plotting marine extreme event data, including parameter setup, map features, colorbars, and animation capabilities.

Initialise the plotter with data and coordinate mappings.

Parameters:
  • xarray_obj (DataArray) – The data to plot

  • dimensions (Dict[str, str] | None) – Mapping of conceptual to actual dimension names

  • coordinates (Dict[str, str] | None) – Mapping of conceptual to actual coordinate names

__init__(xarray_obj, dimensions=None, coordinates=None)[source]

Initialise the plotter with data and coordinate mappings.

Parameters:
  • xarray_obj (DataArray) – The data to plot

  • dimensions (Dict[str, str] | None) – Mapping of conceptual to actual dimension names

  • coordinates (Dict[str, str] | None) – Mapping of conceptual to actual coordinate names

Return type:

None

Methods

__init__(xarray_obj[, dimensions, coordinates])

Initialise the plotter with data and coordinate mappings.

animate(config[, plot_dir, file_name, ...])

Create an animation from time series data

clim_robust(data, issym[, percentiles])

Compute robust colour limits from data percentiles.

multi_plot(config[, col, col_wrap])

Make wrapped subplots with given configuration

plot(ax[, cmap, clim, norm])

Abstract method to be implemented by subclasses

setup_id_plot_params([cmap])

Set up parameters for plotting IDs

setup_plot_params()

Set up common plotting parameters

single_plot(config[, ax])

Make a single plot with given configuration

__init__(xarray_obj, dimensions=None, coordinates=None)[source]

Initialise the plotter with data and coordinate mappings.

Parameters:
  • xarray_obj (DataArray) – The data to plot

  • dimensions (Dict[str, str] | None) – Mapping of conceptual to actual dimension names

  • coordinates (Dict[str, str] | None) – Mapping of conceptual to actual coordinate names

Return type:

None

single_plot(config, ax=None)[source]

Make a single plot with given configuration

Parameters:
Return type:

Tuple[Figure, Axes, Any]

multi_plot(config, col='time', col_wrap=3)[source]

Make wrapped subplots with given configuration

Parameters:
Return type:

Tuple[Figure, ndarray[tuple[Any, …], dtype[Any]]]

animate(config, plot_dir='./', file_name=None, centroids=None, object_ids=None)[source]

Create an animation from time series data

Parameters:
  • config (PlotConfig) – Plot configuration (including framerate for animation, default 10 fps)

  • plot_dir (str | Path) – Directory to save animation files

  • file_name (str | None) – Name for the output animation file

  • centroids (DataArray | None) – Optional DataArray containing centroid data with dimensions (component, time, ID)

  • object_ids (DataArray | None) – Optional DataArray containing object ID field with integers > 0 for drawing contour outlines

Return type:

str | None

clim_robust(data, issym, percentiles=None)[source]

Compute robust colour limits from data percentiles.

Parameters:
Return type:

ndarray[tuple[Any, …], dtype[float64]]

setup_plot_params()[source]

Set up common plotting parameters

Return type:

None

setup_id_plot_params(cmap=None)[source]

Set up parameters for plotting IDs

Parameters:

cmap (str | ListedColormap | None)

Return type:

Tuple[ListedColormap, BoundaryNorm, str]

plot(ax, cmap='viridis', clim=None, norm=None)[source]

Abstract method to be implemented by subclasses

Parameters:
Return type:

Tuple[Axes, Any]