flopy.utils.voronoi module

class VoronoiGrid(points, **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:
  • points (ndarray) – Two dimensional array of points with x in column 0 and y in column 1. These points will become cell centers in the voronoi grid.
  • 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

The points passed into this class are marked as the cell center locations. Along the edges, these cell centers do not correspond to the centroid location of the cell polygon. Instead, the cell centers are along the edge.

This class does not yet support holes, which are supported by the Triangle class. This is a feature that could be added in the future.

get_disu5_gridprops()[source]
get_disu6_gridprops()[source]
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

get_sorted_vertices(icell_vertices, vertices)[source]
get_valid_faces(vor)[source]
get_voronoi_grid(points, **kwargs)[source]
point_in_cell(point, vertices)[source]
sort_vertices(vlist)[source]