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, map=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='', **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

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 (meters)
y1 y-coordinate of the lower-left corner of the data raster (meters)
x2 x-coordinate of the upper-right corner of the data raster (meters)
y2 y-coordinate of the upper-right corner of the data raster (meters)
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
map : str

Optional method for plotting a map. See pysteps.visualization.precipifields.plot_precip.field.

units : str

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

colorscale : str

Which colorscale to use.

title : str

If not None, print the 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.

kwargs : dict

Optional keyword arguments that are supplied to plot_precip_field and quiver/streamplot.