This module provides a way for discretize meshes to be converted to VTK data objects (and back when possible) if the VTK Python package is available. The discretize.mixins.vtkModule.InterfaceVTK class becomes inherrited by all mesh objects and allows users to directly convert any given mesh by calling that mesh’s to_vtk() method (note that this method will not be available if VTK is not available).

This functionality was originally developed so that discretize could be interoperable with PVGeo, providing a direct interface for discretize meshes within ParaView and other VTK powered platforms. This interoperablity allows users to visualize their finite volume meshes and model data from discretize along side all their other georeferenced datasets in a common rendering environment.

Another notable VTK powered software platforms is pyvista (see pyvista docs) which provides a direct interface to the VTK software library through accesible Python data structures and NumPy arrays:

pip install pyvista

By default, the to_vtk() method will return a pyvista data object so that users can immediately start visualizing their data in 3D.

See 3D Visualization with PyVista for an example of the types of integrated visualizations that are possible leveraging the link between discretize, pyvista, and PVGeo:

PVGeo Example Visualization

Laguna del Maule Bouguer Gravity

This data scene is was produced from the Laguna del Maule Bouguer Gravity example provided by Craig Miller (see Maule volcanic field, Chile. Refer to Miller et al 2016 EPSL for full details.)

The rendering below shows several data sets and a model integrated together:

  • Point Data: the Bouguer gravity anomalies
  • Topography Surface
  • Inverted Model: The model has been both sliced and thresholded for low values


discretize.mixins.vtkModule.InterfaceTensorread_vtk Provides a convienance method for reading VTK Rectilinear Grid files as TensorMesh objects.
discretize.mixins.vtkModule.InterfaceVTK This class is full of methods that enable discretize meshes to be converted to VTK data objects (and back when possible).
discretize.mixins.vtkModule.vtkXMLRectilinearGridReader vtkXMLRectilinearGridReader - Read VTK XML RectilinearGrid files.
discretize.mixins.vtkModule.vtkXMLRectilinearGridWriter vtkXMLRectilinearGridWriter - Write VTK XML RectilinearGrid files.
discretize.mixins.vtkModule.vtkXMLStructuredGridWriter vtkXMLStructuredGridWriter - Write VTK XML StructuredGrid files.
discretize.mixins.vtkModule.vtkXMLUnstructuredGridWriter vtkXMLUnstructuredGridWriter - Write VTK XML UnstructuredGrid files.


discretize.mixins.vtkModule.assign_cell_data(vtkDS) Assign the model(s) to the VTK dataset as CellData