1

I have a .vtk file (0.25 TB) n ASCII format which I visualize in ParaView. I like to transfer the data to my collaborators for which I would like to convert it into a binary format.

I tried to search through the internet and was unsuccessful in obtaining a solution.

Can anyone help me with this ?

Thanks, Prithivi

Mechanician
  • 525
  • 1
  • 6
  • 20

2 Answers2

4

You can open your .vtk file in ParaView and then save it in binary format but it won't compress it for you:

  • File -> Save Data -> Choose Legacy VTK Files (.vtk) format -> Change ASCII to Binary.

But, you could be more detailed here:

  • If your data is a VTK unstructured grid: File -> Save Data -> Choose VTK UnstructuredGrid Files (.vtu) -> Data Mode to Appended -> Compressor Type to LZMA -> Compression Level to 9 to get smallest file

  • If your data is a VTK structured grid: File -> Save Data -> Choose VTK StructuredGrid Files (.vts) -> Data Mode to Appended -> Compressor Type to LZMA -> Compression Level to 9 to get smallest file

  • If your data is a VTK polydata: File -> Save Data -> Choose VTK PolyData Files (.vtp) -> Data Mode to Appended -> Compressor Type to LZMA -> Compression Level to 9 to get smallest file

1

My file is quite huge so can;t be opened via Paraview. To do it using the script, I found the following piece of python code to be useful.

from paraview.simple import *
r = LegacyVTKReader( FileNames=['Yourfilename.vtk'] )
SaveData('Yourfilename_binary.vtk', proxy=r)
Mechanician
  • 525
  • 1
  • 6
  • 20
  • The function `SaveData()` is not working with Paraview's older versions (like 3.98.1). I found its implementation [here](https://kitware.github.io/paraview-docs/latest/python/_modules/paraview/simple.html) and moved it to my code. How can I save my file as ASCII? Calling it like `SaveData(filename, proxy=px, FileType='Ascii')` is not working. – ACR Sep 04 '20 at 19:33