PVDReader#

class PVDReader(*args, **kwargs)[source]#

PVD Reader for .pvd files.

Reading a time point returns a pyvista.MultiBlock, even when it contains only one dataset. This differs from ParaView, which returns the dataset directly for PVD files with one dataset per time point. Index the returned blocks to access an individual dataset. Selecting the first block does not combine multiple blocks.

Examples#

Download Python source code | Download Jupyter notebook

>>> import pyvista as pv
>>> from pyvista import examples
>>> from pathlib import Path
>>> filename = examples.download_wavy(load=False)
>>> Path(filename).name
'wavy.pvd'
>>> reader = pv.get_reader(filename)
>>> reader.time_values
[0.0, 1.0, 2.0, 3.0, ... 12.0, 13.0, 14.0]
>>> reader.set_active_time_point(5)
>>> reader.active_time_value
5.0
>>> blocks = reader.read()
>>> blocks.n_blocks
1
>>> mesh = blocks[0]
>>> isinstance(mesh, pv.StructuredGrid)
True
>>> mesh.plot(scalars='z')
../../../_images/pyvista-PVDReader-3f633aa5da3e1994_00_00.png

Inheritance#

Inherited members are documented on BaseReader, _FileIOBase, TimeReader.

See them all under Inherited Attributes and Inherited Methods.

Attributes#

PVDReader.active_datasets

Return all active datasets.

PVDReader.active_readers

Return the active readers.

PVDReader.active_time_value

Active time or iteration value.

PVDReader.datasets

Return all datasets.

PVDReader.number_time_points

Return number of time points or iterations available to read.

PVDReader.time_values

All time or iteration values.

Inherited Attributes#

_FileIOBase.extension_patterns

Return mapping from regex pattern matching associated with this class.

_FileIOBase.extensions

Return the file extensions associated with this class.

BaseReader.path

Return or set the filename or directory of the reader.

BaseReader.reader

Return the vtk Reader object.

Methods#

PVDReader.set_active_time_point(time_point)

Set active time or iteration by index.

PVDReader.set_active_time_value(time_value)

Set active time or iteration value.

PVDReader.time_point_value(time_point)

Value of time point or iteration by index.

Inherited Methods#

BaseReader.hide_progress

Hide the progress bar when loading the file.

BaseReader.read

Read data in file.

BaseReader.show_progress

Show a progress bar when loading the file.