pysteps.visualization.animations.animate

pysteps.visualization.animations.animate(R_obs, nloops=2, timestamps=None, R_fct=None, timestep_min=5, UV=None, motion_plot='quiver', geodata=None, colorscale='pysteps', units='mm/h', colorbar=True, type='ensemble', prob_thr=None, plotanimation=True, savefig=False, fig_dpi=150, fig_format='png', path_outputs='', motion_kwargs={}, map_kwargs={})

Function to animate observations and forecasts in pysteps.

Parameters
R_obs: array-like

Three-dimensional array containing the time series of observed precipitation fields.

Returns
ax: fig axes

Figure axes. Needed if one wants to add e.g. text inside the plot.

Other Parameters
nloops: int

Optional, the number of loops in the animation.

R_fct: array-like

Optional, the three or four-dimensional (for ensembles) array containing the time series of forecasted precipitation field.

timestep_min: float

The time resolution in minutes of the forecast.

UV: array-like

Optional, the motion field used for the forecast.

motion_plot: string

The method to plot the motion field.

geodata: dictionary or None

Optional dictionary containing geographical information about the field. If geodata is not None, it must contain the following key-value pairs:

Key

Value

projection

PROJ.4-compatible projection definition

x1

x-coordinate of the lower-left corner of the data raster

y1

y-coordinate of the lower-left corner of the data raster

x2

x-coordinate of the upper-right corner of the data raster

y2

y-coordinate of the upper-right corner of the data raster

yorigin

a string specifying the location of the first element in the data raster w.r.t. y-axis: ‘upper’ = upper border, ‘lower’ = lower border

units: str

Units of the input array (mm/h or dBZ)

colorscale: str

The colorscale argument to pysteps.visualization.precipfields.plot_precip_field().

title: str or None

If not None, print the string as title on top of the plot.

colorbar: bool

If set to True, add a colorbar on the right side of the plot.

type: {‘ensemble’, ‘mean’, ‘prob’}, str

Type of the map to animate. ‘ensemble’ = ensemble members, ‘mean’ = ensemble mean, ‘prob’ = exceedance probability (using threshold defined in prob_thrs).

prob_thr: float

Intensity threshold for the exceedance probability maps. Applicable if type = ‘prob’.

plotanimation: bool

If set to True, visualize the animation (useful when one is only interested in saving the individual frames).

savefig: bool

If set to True, save the individual frames to path_outputs.

fig_dpi: scalar > 0

Resolution of the output figures, see the documentation of matplotlib.pyplot.savefig. Applicable if savefig is True.

path_outputs: string

Path to folder where to save the frames.

motion_kwargs: dict

Optional keyword arguments that are supplied to pysteps.visualization.precipfields.plot_precip_field() or pysteps.visualization.motionfields.quiver().

map_kwargs: dict

Optional keyword arguments that are supplied to pysteps.visualization.motionfields.streamplot().