-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid XML-files #19
Comments
I've never even considered that the output files might not be valid XML since all my (only VTK standard following apparently) consumers happily accept them. I also didn't know that meshio doesn't fully support the VTK standard then, nor that Kitware managed to define a standard that uses xml and isn't fully compliant. Great stuff 🙄 So as far I understood, the only upside of using 'appended-raw' is that the implementation is less complex. Is that correct? And aside from the implementation being trickier, there's no downside to using 'appended-binary', right? |
You are right. In the end, it shouldn't be that hard to rewrite the appending routines. But one has to dig through all that serialization and base64 stuff... |
My main aim would be to produce files, that |
I cannot really justify pushing time into helping with the implementation, but if you can and want to, I could invest a little time in making the test setup better. I've already pushed a quick & dirty check to the generated examples into the |
Another idea: Only downside: the file isn't that readable anymore as before, where the data-metainfo was stored at the top of the file and the actual data was appended. @renefritze , @xylar: would you have any problems with that approach? |
I think having the file be readable has saved me some debugging trouble in the past but I don't have strong feelings about it. Regarding |
I agree with @xylar in that we should be careful to not degrade current use cases. Making the output mode configurable, defaulting to current mode, would be perfectly fine with me though. While not space-efficient in itself, the base64 mode would also allow adding inline gzipping of the data, IIRC. That would be a real long-term benefit for us I think. |
pyevtk stores the data associated with the given mesh in append data, that is given in a
raw
binary format.Setting of
raw
:pyevtk/pyevtk/vtk.py
Line 636 in 488306a
Encoding as binary:
pyevtk/pyevtk/evtk.py
Line 98 in 488306a
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 withascii
-characters as suggested by VTK. Some references: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 withraw
data:pyevtk/pyevtk/vtk.py
Line 514 in 488306a
meshio
already implemented writing routines usingbase64
encoding. We should have a look there:https://github.com/nschloe/meshio/blob/d9c05ae688858b5166630874f3ec875a43b8fd37/meshio/vtu/_vtu.py#L482
The text was updated successfully, but these errors were encountered: