pyvista_zstd.Reader.read_array

pyvista_zstd.Reader.read_array#

Reader.read_array(name: str, *, association: Association) → NDArray[Any]#

Decompress one named array, leaving the rest of the file untouched.

A block of a MultiBlock file is read the same way after indexing to it, as in reader[0].read_array(name, association="point"). A MultiBlock node’s own field arrays use association="field".

Parameters:
namestr

Array name.

association{“point”, “cell”, “field”}

Data the array belongs to.

Returns:
numpy.ndarray

The stored array.

Raises:
KeyError

The dataset has no such array.

TypeError

The file is a MultiBlock and the association is point or cell; index it to a dataset block first.

ValueError

association is not one of the three above.

Examples

>>> import pyvista as pv
>>> import pyvista_zstd
>>> pyvista_zstd.write(pv.Sphere(), "sphere.pv")
>>> reader = pyvista_zstd.Reader("sphere.pv")
>>> reader.read_array("Normals", association="point").shape
(842, 3)