flopy.discretization.vertexgrid module

class VertexGrid(vertices=None, cell2d=None, top=None, botm=None, idomain=None, lenuni=None, crs=None, prjfile=None, xoff=0.0, yoff=0.0, angrot=0.0, nlay=None, ncpl=None, cell1d=None, **kwargs)[source]

Bases: Grid

class for a vertex model grid

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

  • cell2d – list of cells and their vertices

  • top (list or ndarray) – top elevations for all cells in the grid.

  • botm (list or ndarray) – bottom elevations for all cells in the grid.

  • idomain (int or ndarray) – ibound/idomain value for each cell

  • lenuni (int or ndarray) – model length units

  • crs (pyproj.CRS, int, str, optional if prjfile is specified) – Coordinate reference system (CRS) for the model grid (must be projected; geographic CRS are not supported). The value can be anything accepted by pyproj.CRS.from_user_input(), such as an authority string (eg “EPSG:26916”) or a WKT string.

  • prjfile (str or pathlike, optional if crs is specified) – ESRI-style projection file with well-known text defining the CRS for the model grid (must be projected; geographic CRS are not supported).

  • xoff (float) – x coordinate of the origin point (lower left corner of model grid) in the spatial reference coordinate system

  • yoff (float) – y coordinate of the origin point (lower left corner of model grid) in the spatial reference coordinate system

  • angrot (float) – rotation angle of model grid, as it is rotated around the origin point

  • **kwargs (dict, optional) –

    Support deprecated keyword options.

    Deprecated since version 3.5: The following keyword options will be removed for FloPy 3.6:

    • prj (str or pathlike): use prjfile instead.

    • epsg (int): use crs instead.

    • proj4 (str): use crs instead.

  • 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
convert_grid(factor)[source]

Method to scale the model grid based on user supplied scale factors

Parameters:

factor

Return type:

Grid object

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

property geo_dataframe

Returns a geopandas GeoDataFrame of the model grid

Return type:

GeoDataFrame

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)