pyvista_zstd.write#
- pyvista_zstd.write(ds: DataSet, filename: Path | str, *, progress_bar: bool = False, force_int32: bool = True, level: int = 3, n_threads: int | None = None, shuffle: ShuffleSpec = False) None#
Compress a PyVista or VTK dataset.
Supports the following classes.
All file types should end in
.pv, borrowing both from the legacy VTK extension.vtkand the.zstfile types.- Parameters:
- dspyvista.DataSet
Dataset to compress. All PyVista dataset types except for
pyvista.MultiBlockare supported.- filenamepathlib.Path | str
Path to the file.
- force_int32bool, default: True
Write cell topology as int32 whenever possible. Only applies to
pyvista.PolyDataandpyvista.UnstructuredGrid. A mesh whose point ids do not fit in int32 keeps its wider topology; the request is a preference, not a promise to narrow.- progress_barbool, default: False
Show a progress bar while writing to disk.
- levelint, default: 3
Compression level. Valid values are all negative integers through 22. Lower values generally yield faster operations with lower compression ratios. Higher values are generally slower but compress better.
- n_threadsint, optional
Number of threads to use when compressing. A value of
-1uses all available cores and0disables multi-threading.- shuffle{“auto”, True, False}, default: False
Optionally apply a reversible byte-shuffle pre-filter before compression. The filter splits each array into byte planes, which can let zstd compress smooth floating-point data somewhat better. Disabled by default.
"auto"shuffles a multibyte floating-point array only when a quick trial compression shows it shrinks the data (so it never enlarges a file);Trueshuffles every multibyte array. Files that use the filter are written at format version 1 and can only be read by this release or newer; unfiltered files (the default) stay backward compatible unless they use fixed-width cell arrays.
Notes
Cell arrays whose cells all contain the same number of points are stored without their redundant offsets array. Their common width is recorded in dataset metadata and VTK reconstructs the offsets when the file is read. Files using this encoding are written at format version 2.