API Reference

API Reference#

API reference for pyvista-zstd.

Convenience Functions#

pyvista-zstd exposes convenience functions to easily read and write compressed datasets using Zstandard

pyvista_zstd.read() and pyvista_zstd.write() work on files. A container that is already in memory, rather than on disk, is read with pyvista_zstd.read_buffer(), and a single array with pyvista_zstd.read_array(). pyvista_zstd.append_arrays() adds arrays to an existing file.

pyvista_zstd.read(filename[, n_threads, backend])

Decompress a pyvista-zstd file.

pyvista_zstd.read_buffer(data[, n_threads])

Decompress a pyvista-zstd container already held in memory.

pyvista_zstd.read_array(filename, name, *[, ...])

Read a single array back without full decompression.

pyvista_zstd.append_arrays(filename, arrays, *)

Append named arrays to an existing .pv file in place.

pyvista_zstd.write(ds, filename, *[, ...])

Compress a PyVista or VTK dataset.

Classes#

pyvista-zstd also exposes two classes to fine tune how datasets are read and written. For example, using the pyvista_zstd.Reader, you can select the arrays you wish to read in or even progressively read in individual datasets from a pyvista.MultiBlock.

pyvista_zstd.Reader([filename, buffer, ...])

Class to control pyvista-zstd file decompression.

pyvista_zstd.Writer(ds, filename)

Class to write a pyvista-zstd file.

The reader also describes a file without decompressing its arrays, and reads one array at a time:

with pyvista_zstd.Reader("mesh.pv") as reader:
    meta = reader.dataset_metadata  # type, sizes, array shapes and dtypes
    level = reader.file_metadata.compression_level
    stress = reader.read_array("stress", association="cell")

For a pyvista.MultiBlock, index the reader to a block first, as in reader[0][1].read_array("Normals", association="point").

Metadata#

Returned by pyvista_zstd.Reader.dataset_metadata and pyvista_zstd.Reader.file_metadata.

pyvista_zstd.DataSetMetadata(ds_type, uid, ...)

Metadata of one stored dataset, known without decompressing its arrays.

pyvista_zstd.MultiBlockMetadata(uid, ...)

Metadata of a stored pyvista.MultiBlock.

pyvista_zstd.ArrayInfo(shape, dtype)

Shape and dtype of one stored array, known without decompressing it.

pyvista_zstd.ZstdFileMetadata(frame_names, ...)

File-level facts of a pyvista-zstd container.