Skip to content

Commit

Permalink
feat(export): include particle track polylines in VTK exports (#1750)
Browse files Browse the repository at this point in the history
* feat(export): include particle track polylines in VTK exports
* docs: add notebook demoing vtk export, pyvista 3d plot & animation
  • Loading branch information
wpbonelli committed Apr 19, 2023
1 parent 945be7c commit 17031e5
Show file tree
Hide file tree
Showing 5 changed files with 875 additions and 42 deletions.
21 changes: 9 additions & 12 deletions autotest/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,24 +1437,21 @@ def test_vtk_pathline(function_tmpdir, example_data_path):

from vtkmodules.util import numpy_support

totim = numpy_support.vtk_to_numpy(data.GetCellData().GetArray("time"))
pid = numpy_support.vtk_to_numpy(data.GetCellData().GetArray("particleid"))
totim = numpy_support.vtk_to_numpy(data.GetPointData().GetArray("time"))
pid = numpy_support.vtk_to_numpy(
data.GetPointData().GetArray("particleid")
)

maxtime = 0
for p in plines:
if np.max(p["time"]) > maxtime:
maxtime = np.max(p["time"])

if not len(totim) == 12054:
raise AssertionError("Array size is incorrect for modpath VTK")

if not np.abs(np.max(totim) - maxtime) < 100:
raise AssertionError("time values are incorrect for modpath VTK")

if not len(np.unique(pid)) == len(plines):
raise AssertionError(
"number of particles are incorrect for modpath VTK"
)
assert len(totim) == 12054, "Array size is incorrect"
assert np.abs(np.max(totim) - maxtime) < 100, "time values are incorrect"
assert len(np.unique(pid)) == len(
plines
), "number of particles are incorrect for modpath VTK"


def grid2disvgrid(nrow, ncol):
Expand Down
1 change: 1 addition & 0 deletions etc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies:
- geojson
- vtk
- rasterstats
- pyvista

# MODFLOW API dependencies
- bmipy
Loading

0 comments on commit 17031e5

Please sign in to comment.