If you are using Python, I highly recommend using PyVista: https://docs.pyvista.org which is a more Pythonic interface to VTK. And it has some more documentation on how to use the gradient filter:
- https://docs.pyvista.org/core/filters.html#pyvista.DataSetFilters.compute_gradient
- https://docs.pyvista.org/examples/01-filter/gradients.html
see also: Gradient of Unstrucutred Grid in Python