Reading unstructured VTK data into a structured 2D numpy array

vtkReader.py (812 Bytes)

Dear Sir/Madam,

I have output from the Gusto model in the form of ptvu files, files which contain data from an unstructured grid. It was necessary to run Gusto as a parallel computation in order to keep the walltime practical. The Gusto model simulated the flow of fluid in a 2D domain. I need to carry out some more advanced analysis on the Gusto results and would like to read the ptvu files into structured 2D numpy arrays for this purpose. This will allow me to use previously developed analysis software that I wrote in Python.

I have recently started to use pvpython and have managed to read the unstructured ptvu data into a numpy vector (see attached script). However, I need to re-order this vector into the 2D array associated with the simulated flow domain.

I previously tried to do the re-ordering manually, however, it did not prove simple and I found some differences between my results and what you see when you load the ptvu files into ParaView. That is, I simply printed the values of my 2D numpy arrays and found some differences with what you see using the Spreadsheet View in ParaView.

So my main question: is there a way to ask ParaView to re-order the unstructured data for me? Presumably this is what is done in ParaView to be able to view the unstructured data in the ptvu files? Do I need to re-order on the server side before fetching the data to the client?

I would be very grateful for some help!

With best regards,
Paul