xarray_video.VideoArray#

class xarray_video.VideoArray(xarray_arr)[source]#

Video extension for xarray.DataArray.

Implements operations on a dataset which includes video data

Methods

__init__(xarray_arr)[source]#
play(interval=10, repeat=False, **kwargs)[source]#

Play DataArray as a video using matplotlib.animation.

All the video data is loaded into buffered in memory before rendering. Large video sequences cannot be played with this function. Note that this function is unlikely to play the video at the correct frame rate.

Parameters:
  • start_time (Union[datetime.datetime,str,:class:numpy.datetime64], “optional*) – Start time of video array

  • interval (int, optional) – Interval in milliseconds between each frame render (default 0)

  • repeat (bool, optional) – Repeat animation (default False)

Kwargs:

kwargs are passed to matplotlib.pyplot.figure

Raises:

VideoError – if DataArray does not represent an video or the video array is too large

plot(**kwargs)[source]#

Plot DataArray frame as an image using matplotlib.imshow

Raises:

VideoError – if DataArray does not represent an image

to_video(filename)[source]#

Write DataArray to a video file

Parameters:

filename (string) – name of output file

Raises:

VideoWriteError – Incompatible DataArray or file write error