pysteps.visualization.animations.animate(precip_obs, precip_fct=None, timestamps_obs=None, timestep_min=None, motion_field=None, ptype='ensemble', motion_plot='quiver', geodata=None, title=None, prob_thr=None, display_animation=True, nloops=1, time_wait=0.2, savefig=False, fig_dpi=100, fig_format='png', path_outputs='', precip_kwargs=None, motion_kwargs=None, map_kwargs=None)#

Function to animate observations and forecasts in pysteps.

It also allows to export the individual frames as figures, which is useful for constructing animated GIFs or similar.

  • precip_obs (array-like) – Three-dimensional array containing the time series of observed precipitation fields.

  • precip_fct (array-like, optional) – The three or four-dimensional (for ensembles) array containing the time series of forecasted precipitation field.

  • timestamps_obs (list of datetimes, optional) – List of datetime objects corresponding to the time stamps of the fields in precip_obs.

  • timestep_min (float, optional) – The time resolution in minutes of the forecast.

  • motion_field (array-like, optional) – Three-dimensional array containing the u and v components of the motion field.

  • motion_plot (string, optional) – The method to plot the motion field. See plot methods in pysteps.visualization.motionfields.

  • 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:




    PROJ.4-compatible projection definition


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


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


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


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


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

  • title (str or None, optional) – If not None, print the string as title on top of the plot.

  • ptype ({'ensemble', 'mean', 'prob'}, str, optional) – Type of the plot to animate. ‘ensemble’ = ensemble members, ‘mean’ = ensemble mean, ‘prob’ = exceedance probability (using threshold defined in prob_thrs).

  • prob_thr (float, optional) – Intensity threshold for the exceedance probability maps. Applicable if ptype = ‘prob’.

  • display_animation (bool, optional) – If set to True, display the animation (set to False if only interested in saving the animation frames).

  • nloops (int, optional) – The number of loops in the animation.

  • time_wait (float, optional) – The time in seconds between one frame and the next. Applicable if display_animation is True.

  • savefig (bool, optional) – If set to True, save the individual frames into path_outputs.

  • fig_dpi (float, optional) – The resolution in dots per inch. Applicable if savefig is True.

  • fig_format (str, optional) – Filename extension. Applicable if savefig is True.

  • path_outputs (string, optional) – Path to folder where to save the frames. Applicable if savefig is True.

  • precip_kwargs (dict, optional) – Optional parameters that are supplied to pysteps.visualization.precipfields.plot_precip_field().

  • motion_kwargs (dict, optional) – Optional parameters that are supplied to pysteps.visualization.motionfields.quiver() or pysteps.visualization.motionfields.streamplot().

  • map_kwargs (dict, optional) – Optional parameters that need to be passed to pysteps.visualization.basemaps.plot_geography().

Return type: