zvtk.Reader.show_frame_compression

zvtk.Reader.show_frame_compression#

Reader.show_frame_compression() str#

Return a table showing compression statistics for each frame in the dataset.

For MultiBlock datasets, shows a hierarchical view with compression stats for each block. For regular datasets, shows stats for each array.

Examples

Download the aero bracket dataset.

>>> import pyvista as pv
>>> from pyvista import examples
>>> import zvtk
>>> ds = examples.download_aero_bracket()
>>> ds
UnstructuredGrid (0x7fd751589360)
  N Cells:    117292
  N Points:   187037
  X Bounds:   -6.858e-03, 1.118e-01
  Y Bounds:   -1.237e-02, 6.634e-02
  Z Bounds:   -1.638e-02, 1.638e-02
  N Arrays:   3

Compress it and then show the compressed frame sizes through the reader.

>>> zvtk.write(ds, "bracket.zvtk")
>>> reader = zvtk.Reader("bracket.zvtk")
>>> print(reader.show_frame_compression())
Dataset ID       Frame Type                      Compressed   Decompressed Ratio
--------------------------------------------------------------------------------
00007fd751589360 Points                          1.9MB        2.1MB        0.877
00007fd751589360 Cell Types                      22.0B        114.5KB      0.000
00007fd751589360 Offsets: cells                  330.5KB      458.2KB      0.721
00007fd751589360 Connectivity: cells             2.2MB        4.5MB        0.499
00007fd751589360 Point Data: displacement        2.0MB        2.1MB        0.935
00007fd751589360 Point Data: total nonlinear st  4.0MB        4.3MB        0.938
00007fd751589360 Point Data: von Mises stress    650.7KB      730.6KB      0.891
--------------------------------------------------------------------------------
TOTAL                                            11.1MB       14.3MB       0.775

Note how the compression ratio can be marginally improved by increasing the compression level.

>>> zvtk.write(ds, "bracket.zvtk", level=22)
>>> reader = zvtk.Reader("bracket.zvtk")
Dataset ID       Frame Type                      Compressed   Decompressed Ratio
--------------------------------------------------------------------------------
00007fd751589360 Points                          1.8MB        2.1MB        0.863
00007fd751589360 Cell Types                      21.0B        114.5KB      0.000
00007fd751589360 Offsets: cells                  56.1KB       458.2KB      0.123
00007fd751589360 Connectivity: cells             1.6MB        4.5MB        0.358
00007fd751589360 Point Data: displacement        2.0MB        2.1MB        0.937
00007fd751589360 Point Data: total nonlinear st  4.0MB        4.3MB        0.940
00007fd751589360 Point Data: von Mises stress    651.7KB      730.6KB      0.892
--------------------------------------------------------------------------------
TOTAL                                            10.2MB       14.3MB       0.711