Export Routines
- py2vtk.core.evtk.encodeData(data, format, level=0, compressor='zlib')
Encodes a single numpy ndarray of a 3-tuple of arrays using a specific and a compression level if relevant.
Parameters
- dataarray or list of arrays of tuple or arrays
data to encode
- formatstr in {‘ascii’, ‘binary’, ‘raw’}
encoding format
- levelint, optional
compression level
- compressorstr in {‘zlib’, ‘lzma’}
compression library
Returns
- sizeint
size in bytes of the encoded data with the header
- encoded_databytes
encoded data with header
- py2vtk.core.evtk.compress(array, level, compress_func)
Compress an array with a compressor. Taken from uvw, https://github.com/prs513rosewood/uvw
Parameters
- arrayndarray
data to compress
- levelint
Level of compression. Its meaning depends on the
compress_func
argument- compress_funccallable
Compression function. Should take at least an a bytes arrays and an integer as argument
Returns
- header, compressed_databytes, b string
header
is the header of the compressed data. In the case of VTK, this follows the convention described here (https://vtk.org/Wiki/VTK_XML_Formats#Compressed_Data).compressed_data
is the string made by joining all of the blocks.