nschloe/meshio

[BUG] "ValueError: buffer size must be a multiple of element size" when loading VTU file

frantic0 opened this issue · 1 comments

Describe the bug

Hello,

I'm trying to open up a .VTU file that was generated from salome and elmer pipeline. The file opens successfully in Paraview, but I can't seem to open it with meshio on Python script loading in Salome or directly in ipython

To Reproduce

Minimal code example

meshio.read(FILE) # FILE is in https://github.com/frantic0/vtu_test/blob/main/case-40000_t0001.vtu

Traceback (most recent call last):
File "", line 1, in
File "\Python\lib\site-packages\meshio_helpers.py", line 69, in read
return reader_mapfile_format
File "\Python\lib\site-packages\meshio\vtu_vtu.py", line 554, in read
reader = VtuReader(filename)
File "\Python\lib\site-packages\meshio\vtu_vtu.py", line 393, in init
piece_point_data[c.attrib["Name"]] = self.read_data(c)
File "\Python\lib\site-packages\meshio\vtu_vtu.py", line 544, in read_data
data = reader(self.appended_data[offset:], dtype)
File "\Python\lib\site-packages\meshio\vtu_vtu.py", line 459, in read_uncompressed_binary
return np.frombuffer(byte_string[:total_num_bytes], dtype=dtype)
ValueError: buffer size must be a multiple of element size

Diagnose

Output of 'pip freeze | grep meshio' in the salome sandbox
meshio==4.4.6

Output of 'pip freeze | grep meshio' in the ipython environment
meshio==5.3.0

sorry, there was a problem with the VTU file. Tried with another file and it worked