-
Notifications
You must be signed in to change notification settings - Fork 15
Description
pyevtk stores the data associated with the given mesh in append data, that is given in a raw
binary format.
Setting of raw
:
Line 636 in 488306a
encoding="raw" |
Encoding as binary:
Line 98 in 488306a
bin_pack = struct.pack(fmt, *dd) |
This is producing invalid XML files and other software is may unwilling to read the files (e.g. meshio
see: nschloe/meshio#786)
We should use base64
encoded data, where the binary data is encoded with ascii
-characters as suggested by VTK. Some references:
- https://vtk.org/Wiki/VTK_XML_Formats
- http://www.earthmodels.org/software/vtk-and-paraview/vtk-file-formats
- https://mathema.tician.de/what-they-dont-tell-you-about-vtk-xml-binary-formats/
When using appended data with base64, we have to keep in mind, that the offsets are changing, since they address the character in the base64
encoded string and not the binary offset like with raw
data:
Line 514 in 488306a
self.offset += ( |
meshio
already implemented writing routines using base64
encoding. We should have a look there:
https://github.com/nschloe/meshio/blob/d9c05ae688858b5166630874f3ec875a43b8fd37/meshio/vtu/_vtu.py#L482