flopy.utils.voronoi module¶
- class VoronoiGrid(tri, **kwargs)[source]¶
Bases:
object
FloPy VoronoiGrid helper class for creating a voronoi model grid from an array of input points that define cell centers. The class handles boundary cells by closing polygons along the edge, something that cannot be done directly with the scipy.spatial.Voronoi class.
- Parameters
input (flopy.utils.Triangle) – Constructred and built flopy Triangle object.
kwargs (dict) – List of additional keyword arguments that will be passed through to scipy.spatial.Voronoi. For circular shaped model grids, the qhull_options=’Qz’ option has been found to work well.
Notes
When using VoronoiGrid, the construction order used for the Triangle grid matters. The first add_polygon() call must be to add the model domain. Then add_polygon() must be used to add any holes. Lastly, add_polygon() can be used to add regions. This VoronoiGrid class uses this order to find model edges that require further work for defining and closing edge model cells.
- get_disv_gridprops()[source]¶
Get a dictionary of arguments that can be passed in to the flopy.mf6.ModflowGwfdisv class.
- Returns
disv_gridprops – Dictionary of arguments than can be unpacked into the flopy.mf6.ModflowGwfdisv constructor
- Return type
dict
- get_gridprops_unstructuredgrid()[source]¶
Get a dictionary of information needed to create a flopy UnstructuredGrid. The returned dictionary can be unpacked directly into the flopy.discretization.UnstructuredGrid() constructor.
- Returns
gridprops
- Return type
dict
- get_gridprops_vertexgrid()[source]¶
Get a dictionary of information needed to create a flopy VertexGrid. The returned dictionary can be unpacked directly into the flopy.discretization.VertexGrid() constructor.
- Returns
gridprops
- Return type
dict
- get_patch_collection(ax=None, **kwargs)[source]¶
Get a matplotlib patch collection representation of the voronoi grid
- Parameters
ax (matplotlib.pyplot.Axes) – axes to plot the patch collection
kwargs (dict) – Additional keyward arguments to pass to the flopy.plot.plot_cvfd function that returns a patch collection from verts and iverts
- Returns
pc – patch collection of model
- Return type
matplotlib.collections.PatchCollection
- plot(ax=None, plot_title=True, **kwargs)[source]¶
Plot the voronoi model grid
- Parameters
ax (matplotlib.pyplot.Axes) – axes to plot the voronoi grid
plot_title (bool) – Add the number of cells and number of vertices as a plot title
kwargs (dict) – Additional keyword arguments to pass to self.get_patch_collection
- Returns
ax – axes that contains the voronoi model grid
- Return type
matplotlib.pyplot.Axes
- tri2vor(tri, **kwargs)[source]¶
This is the workhorse for the VoronoiGrid class for creating a voronoi grid from a constructed and built flopy Triangle grid.
- Parameters
tri (flopy.utils.Triangle) –
voronoi (Flopy triangle object is used to construct the complementary) –
diagram. –
- Returns
verts, iverts
- Return type
ndarray, list of lists