pyvista_zstd.append_arrays#
- pyvista_zstd.append_arrays(filename: Path | str, arrays: dict[str, NDArray], *, level: int | None = None, shuffle: ShuffleSpec = False) None#
Append named arrays to an existing
.pvfile in place.Each array is stored as an independently-zstd-compressed
field_datablock. Previously-written compressed frames are never re-read or re-compressed; only the small index plus the file and dataset metadata frames are rewritten, and the whole update is committed atomically.- Parameters:
- filenamepathlib.Path | str
Path to an existing
.pvfile (written bypyvista_zstd.write()or a previousappend_arrays()).- arraysdict[str, numpy.ndarray]
Mapping of
name -> array. Names must not already exist as a field array in the file. Arrays are stored verbatim (bit-exact round trip) regardless of dtype/shape.- levelint, optional
zstd compression level for the new blocks. Defaults to the file’s recorded
compression_levelso appended blocks match the original.- shuffle{“auto”, True, False}, default: False
Optionally apply the reversible byte-shuffle pre-filter to the appended blocks (see
pyvista_zstd.write()). Disabled by default;"auto"shuffles a multibyte floating-point array only when a trial compression shows it shrinks the data. When any appended block is shuffled the file is promoted to format version 1; already-written frames are untouched and keep their own per-block encoding.
- Raises:
- ValueError
A name is already a field array in the file, or the suffix is not one the format uses.
- NotImplementedError
The file is a MultiBlock, which has no root dataset to append to.
Notes
The appended blocks become visible as
field_dataarrays:pyvista_zstd.Reader.read()returns them ingrid.field_dataandpyvista_zstd.Reader.available_field_arrayslists them. Useread_array()/AppendReaderto read one block back without decompressing the rest of the file.