flopy.discretization.vertexgrid module

class VertexGrid(vertices=None, cell2d=None, top=None, botm=None, idomain=None, lenuni=None, epsg=None, proj4=None, prj=None, xoff=0.0, yoff=0.0, angrot=0.0, nlay=None, ncpl=None, cell1d=None)[source]

Bases: flopy.discretization.grid.Grid

class for a vertex model grid

Parameters
  • vertices – list of vertices that make up the grid

  • cell2d – list of cells and their vertices

  • Properties

  • ----------

  • vertices – returns list of vertices that make up the grid

  • cell2d – returns list of cells and their vertices

get_cell_vertices(cellid)[source]

returns vertices for a single cell at cellid.

property cell1d
property cell2d
property extent
classmethod from_binary_grid_file(file_path, verbose=False)[source]

Instantiate a VertexGrid model grid from a MODFLOW 6 binary grid (*.grb) file.

Parameters
  • file_path (str) – file path for the MODFLOW 6 binary grid file

  • verbose (bool) – Write information to standard output. Default is False.

Returns

return

Return type

VertexGrid

get_cell_vertices(cellid)[source]
Method to get a set of cell vertices for a single cell

used in the Shapefile export utilities

Parameters

cellid – (int) cellid number

Returns ——- list of x,y cell vertices

get_number_plottable_layers(a)[source]

Calculate and return the number of 2d plottable arrays that can be obtained from the array passed (a)

Parameters

a (ndarray) – array to check for plottable layers

Returns

nplottable – number of plottable layers

Return type

int

get_plottable_layer_array(a, layer)[source]
get_xcellcenters_for_layer(layer)[source]
get_xvertices_for_layer(layer)[source]
get_ycellcenters_for_layer(layer)[source]
get_yvertices_for_layer(layer)[source]
property grid_lines

Creates a series of grid line vertices for drawing a model grid line collection

Returns

grid line vertices

Return type

list

intersect(x, y, z=None, local=False, forgive=False)[source]

Get the CELL2D number of a point with coordinates x and y

When the point is on the edge of two cells, the cell with the lowest CELL2D number is returned.

Parameters
  • x (float) – The x-coordinate of the requested point

  • y (float) – The y-coordinate of the requested point

  • z (float, None) – optional, z-coordiante of the requested point will return (lay, icell2d)

  • local (bool (optional)) – If True, x and y are in local coordinates (defaults to False)

  • forgive (bool (optional)) – Forgive x,y arguments that fall outside the model grid and return NaNs instead (defaults to False - will throw exception)

Returns

icell2d – The CELL2D number

Return type

int

property is_complete
property is_valid
property iverts
property map_polygons

Get a list of matplotlib Polygon patches for plotting

Return type

list of Polygon objects

property ncpl
property nlay
property nnodes
property nvert
plot(**kwargs)[source]

Plot the grid lines.

Parameters

kwargs (ax, colors. The remaining kwargs are passed into the) – the LineCollection constructor.

Returns

lc

Return type

matplotlib.collections.LineCollection

property shape
property top_botm
property verts
property xyzcellcenters

Method to get cell centers and set to grid

property xyzvertices

Method to get all grid vertices in a layer, arranged per cell

Returns

list of size sum(nvertices per cell)