Battle 25: VTK visualization
n my recent posts, I discussed how to generate 3D plots using MayaVi and PyVista, both of them works but not as great as I expected. MayaVi has issue with rendering using OpenCL PyVista does not expose enough APIs to control the plot So these are great tools to start with, but later on I decided to switch back to raw VTK. I used another package called PyeVTK (https://github.com/paulo-herrera/PyEVTK), it basically help you to export data into the VTK format.
As we know, VTK supports the legacy (text-based) and new (xml-based) format. In earlier days, I already developed two models to export data to the legacy format. One of them is in my Git: https://github.com/changliao1025/modelview
This time I decided to use the package which uses XML. It is straightforward to follow the example. You need to be careful with the data section still because of the memory alignment with 3D datasets.
After that, I was able to produce some results:
However, there is some issue with Visit or ParaView, if the mesh cell are too close, there might be an artifact with the rendering. So I increased the distance slightly and the new results look great.
With that, the python package I developed for E3SM can fully support VTK now.