ModelPlotter#

class fridom.framework.modules.animation.model_plotter.ModelPlotter(mz: ModelState)[source]#

Bases: object

A model plotter contains the logic for creating and updating a figure object

Description#

The Model Plotter must be overwriten by child classes to implement the following methods:

create_figure():

create a figure object (e.g. matplotlib figure)

prepare_arguments(mz: ModelState) -> dict:

prepare the arguments for the update_figure method (e.g. extract the field to be plotted and convert it to numpy/xarray)

update_figure(fig, **kwargs):

update the figure object with the given arguments from the prepare_arguments method

convert_to_img(fig):

convert the figure object to a numpy image array. If matplotlib is used, this method does not need to be overwritten. However, if a different plotting library is used, this method must be overwritten.

__init__()#

Methods

__init__()

convert_to_img(fig)

This method should convert the figure object to a numpy image array.

create_figure()

This method should create a figure object (e.g. matplotlib figure) and return it.

prepare_arguments(mz)

This method should prepare the arguments for the update_figure method.

update_figure(fig, *args, **kwargs)

This method should update the figure object with the given model state.

Examples using fridom.framework.modules.animation.ModelPlotter#

Barotropic Jet

Barotropic Jet

Convection and Closures

Convection and Closures

Dancing Eddies

Dancing Eddies

Internal Gravity Wave Maker

Internal Gravity Wave Maker

Multiple Wave Makers

Multiple Wave Makers

Rayleigh-Bénard Convection

Rayleigh-Bénard Convection

Rayleigh-Taylor Instability

Rayleigh-Taylor Instability

Single Internal Wave

Single Internal Wave

Symmetric Instability

Symmetric Instability

Tracers and Eddies

Tracers and Eddies

Reflecting Wave Package

Reflecting Wave Package

Barotropic Instability.

Barotropic Instability.

Equatorial Waves.

Equatorial Waves.
static create_figure()[source]#

This method should create a figure object (e.g. matplotlib figure) and return it.

static prepare_arguments(mz: ModelState) dict[source]#

This method should prepare the arguments for the update_figure method.

static update_figure(fig, *args, **kwargs) None[source]#

This method should update the figure object with the given model state.

static convert_to_img(fig)[source]#

This method should convert the figure object to a numpy image array.