flopy.discretization.vertexgrid module
- class VertexGrid(vertices=None, cell2d=None, top=None, botm=None, idomain=None, lenuni=None, crs=None, epsg=None, proj4=None, prj=None, prjfile=None, xoff=0.0, yoff=0.0, angrot=0.0, nlay=None, ncpl=None, cell1d=None)[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, 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
Properties –
---------- –
vertices – returns list of vertices that make up the grid
cell2d – returns list of cells and their vertices
- 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:
- Returns:
return
- Return type:
- 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:
- property grid_lines
Creates a series of grid line vertices for drawing a model grid line collection
- Returns:
grid line vertices
- Return type:
- 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:
- 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:
- 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)