imod.visualize.grid_3d(da, vertical_exaggeration=30.0, exterior_only=True, exterior_depth=1, return_index=False)[source]#

Constructs a 3D PyVista representation of a DataArray. DataArrays should be two-dimensional or three-dimensional:

  • 2D: dimensions should be {"y", "x"}. E.g. a DEM.

  • 3D: dimensions should be {"z", "y", "x"}, for a voxel model.

  • 3D: dimensions should be {"layer", "y", "x"}, with coordinates

    "top"({"layer", "y", "x"}) and "bottom"({"layer", "y", "x"}).

  • da (xr.DataArray) –

  • vertical_exaggeration (float, default 30.0) –

  • exterior_only (bool, default True) – Whether or not to only draw the exterior. Greatly speeds up rendering, but it means that pyvista slices and filters produce “hollowed out” results.

  • exterior_depth (int, default 1) – How many cells to consider as exterior. In case of large jumps, holes can occur. By settings this argument to a higher value, more of the inner cells will be rendered, reducing the chances of gaps occurring.

  • return_index (bool, default False) –

Return type:



>>> grid = imod.visualize.grid_3d(da)

To plot the grid, call the .plot() method.

>>> grid.plot()

Use .assign_coords to assign tops and bottoms to layer models:

>>> top ="top*.idf")
>>> bottom ="bot*.idf")
>>> kd ="kd*.idf")
>>> kd = kd.assign_coords(top=(("layer", "y", "x"), top))
>>> kd = kd.assign_coords(bottom=(("layer", "y", "x"), bottom))
>>> grid = imod.visualize.grid_3d(kd)
>>> grid.plot()

Refer to the PyVista documentation on how to customize plots: