How to extract data from .pvtr in python?


I have a 2D CFD field, 10+ variables stored in space at point. I want the data as a 2D numpy array in python from a given .pvtr file.

I have tried using vtk python library. Kernal crashes as soon as I try and access the data. I am not sure why. The .pvtr files are written by vtkXMLParallelRectilinearWriter in Fortran, XML version 0.1.

However, Paraview GUI is able to read and 2D plot the data, just fine!
So, I tried using paraview python library to extract the data. I used paraview’s servermanager module and Fetch method. This also crashed, like the python vtk libraries.

Clearly, Paraview GUI can read my data correctly. Are there alternative (not using Fetch) ways I can retrieve data arrays from .pvtr files using Paraview’s library in python ?

(Mathieu Westphal (Kitware)) #2

vtkPython should work for your usecase. Mind sharing your data ?