zvtk.Reader#
- class zvtk.Reader(filename: Path | str)#
Class to control zvtk file decompression.
Use this class in lieu of
zvtk.read()to fine-tune reading in compressed files. With this you can:Inspect the dataset before reading it.
Control which arrays to read in.
For files containing a
pyvista.MultiBlock, select which blocks to read in.
- Parameters:
- filenamepathlib.Path | str
Path to the file. Must end in
.zvtk.
- Attributes:
available_cell_arraysReturn a set of all cell array names available in the dataset.
available_field_arraysReturn a set of all field array names available in the dataset.
available_point_arraysReturn a set of all point array names available in the dataset.
decompressed_sizesReturn decompressed frame sizes.
nbytesReturn the size of the decompressed dataset.
selected_cell_arraysReturn the set of currently selected cell arrays to read.
selected_field_arraysReturn the set of currently selected field arrays to read.
selected_point_arraysReturn the set of currently selected point arrays to read.
Methods
read([n_threads])Read in the dataset from the zvtk file.
Return a table showing compression statistics for each frame in the dataset.
Examples
First write out an example dataset.
>>> import pyvista as pv >>> import zvtk >>> ds = pv.Sphere() >>> zvtk.write(ds, "sphere.zvtk")
Create a reader.
>>> reader = zvtk.Reader("sphere.zvtk") >>> reader zvtk.Decompressor (0x7f1ed1496c00) File: sphere.zvtk File Version: 0 Compression: zstandard Compression Level: 3 Dataset Type: PolyData N Points: 842 (<class 'numpy.float32'>) N Cells: 1680 Point arrays: Normals float32 (842, 3)
Disable reading in point arrays and read the dataset.
>>> reader.selected_point_arrays = set() >>> ds_in = reader.read() >>> ds_in PolyData (0x7f1ece066ce0) N Cells: 1680 N Points: 842 N Strips: 0 X Bounds: -4.993e-01, 4.993e-01 Y Bounds: -4.965e-01, 4.965e-01 Z Bounds: -5.000e-01, 5.000e-01 N Arrays: 0
Methods
Reader.__init__(filename)Initialize the decompressor.
Reader.read([n_threads])Read in the dataset from the zvtk file.
Return a table showing compression statistics for each frame in the dataset.
Attributes
Return a set of all cell array names available in the dataset.
Return a set of all field array names available in the dataset.
Return a set of all point array names available in the dataset.
Return decompressed frame sizes.
Return the size of the decompressed dataset.
Return the set of currently selected cell arrays to read.
Return the set of currently selected field arrays to read.
Return the set of currently selected point arrays to read.