xarray_video package#
Subpackages#
Submodules#
xarray_video.backend module#
- class xarray_video.backend.VideoArrayWrapper(manager, lock, shape)[source]#
Bases:
BackendArrayA wrapper around video dataset objects
- property dtype#
- property shape#
- xarray_video.backend.open_video(filename, start_time=None, **kwargs)[source]#
Video file into an xarray dataset.
This reads a video into an xarray dataset with the video in a DataArray. If a start time is provided, a time axis will be created for the frames.
- Parameters:
filename (string) – filename of videos to open
start_time (
numpy.datetime64) – Start time of video
- Returns:
Dataset with video as a DataArray
- Return type:
dataset (
xarray.Dataset)- Raises:
VideoReadError – Missing or incompatible files
xarray_video.exceptions module#
- exception xarray_video.exceptions.VideoDisplayError[source]#
Bases:
VideoError
- exception xarray_video.exceptions.VideoProcessingError[source]#
Bases:
VideoError
- exception xarray_video.exceptions.VideoReadError[source]#
Bases:
VideoError
- exception xarray_video.exceptions.VideoWriteError[source]#
Bases:
VideoError
xarray_video.videoarray module#
- class xarray_video.videoarray.VideoArray(xarray_arr)[source]#
Bases:
objectVideo extension for
xarray.DataArray.Implements operations on a dataset which includes video data
- 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
xarray_video.videodataset module#
- class xarray_video.videodataset.VideoDataset(xarray_dset)[source]#
Bases:
objectVideo extension for
xarray.Dataset.Implements operations on a dataset which includes video data
- to_video(filename, data_var=None)[source]#
Write Dataset to a video file.
- Parameters:
filename (string) – name of output file
data_var (string, Optional) – Data variable to write as video streams.
- Raises:
VideoWriteError – Incompatible DataArray or file write error