flopy.utils.lgrutil module
- class Lgr(nlayp, nrowp, ncolp, delrp, delcp, topp, botmp, idomainp, ncpp=3, ncppl=1, xllp=0.0, yllp=0.0)[source]
Bases:
object- property child
Return a SimpleRegularGrid object for the child model
- Returns:
simple_regular_grid – simple grid object containing grid information for the child
- Return type:
- get_exchange_data(angldegx=False, cdist=False)[source]
Get the list of parent/child connections
<cellidm1> <cellidm2> <ihc> <cl1> <cl2> <hwva> <angledegx>
- Returns:
exglist – list of connections between parent and child
- Return type:
- get_idomain()[source]
Return the idomain array for the child model. This will normally be all ones unless the idomain array for the parent model is non-rectangular and irregularly shaped. Then, parts of the child model will have idomain zero cells.
- Returns:
idomain – idomain array for the child model
- Return type:
ndarray
- get_lower_left()[source]
Return the lower left corner of the child grid
- Returns:
(xll, yll) – location of lower left corner of the child grid
- Return type:
- get_parent_connections(kc, ic, jc)[source]
Return a list of parent cell indices that are connected to child cell kc, ic, jc.
- get_parent_indices(kc, ic, jc)[source]
Method returns the parent cell indices for this child. The returned indices are in zero-based indexing.
- get_replicated_parent_array(parent_array)[source]
Get a two-dimensional array the size of the child grid that has values replicated from the provided parent array.
- Parameters:
parent_array (ndarray) – A two-dimensional array that is the size of the parent model rows and columns.
- Returns:
child_array – A two-dimensional array that is the size of the child model rows and columns
- Return type:
ndarray
- get_shape()[source]
Return the shape of the child grid
- Returns:
(nlay, nrow, ncol) – shape of the child grid
- Return type:
- property parent
Return a SimpleRegularGrid object for the parent model
- Returns:
simple_regular_grid – simple grid object containing grid information for the parent
- Return type:
- to_disv_gridprops()[source]
Create and return a gridprops dictionary that can be used to create a disv grid (instead of a separate parent and child representation). The gridprops dictionary can be unpacked into the flopy.mf6.Modflowdisv() constructor and flopy.discretization.VertexGrid() constructor.
Note that export capability will only work if the parent and child models have corresponding layers.
- Returns:
gridprops – Dictionary containing ncpl, nvert, vertices, cell2d, nlay, top, and botm
- Return type:
- class LgrToDisv(lgr)[source]
Bases:
object- build_verts_iverts()[source]
Build the verts and iverts members. self.verts is a 2d numpy array of size (nvert, 2). Column 1 is x and column 2 is y. self.iverts is a list of size ncpl (number of cells per layer) with each entry being the list of vertex indices that define the cell.
- find_hanging_vertices()[source]
Hanging vertices are vertices that must be included along the edge of parent cells. These hanging vertices mark the locations of corners of adjacent child cells. Hanging vertices are not strictly necessary to define the shape of a parent cell, but they are required by modflow to describe connections between parent and child cells.
This routine finds hanging vertices parent cells along a parent-child boundary. These hanging vertices are stored in 4 member dictionaries, called right_face_hanging, left_face_hanging, front_face_hanging, and back_face_hanging. These dictionaries are used subsequently to insert hanging vertices into the iverts array.
- get_botm()[source]
Construct a 2d array of size (nlay, ncpl) that contains the cell bottoms.
- Returns:
botm – 2d array of bottom elevations
- Return type:
ndarray
- get_disv_gridprops()[source]
Create and return a gridprops dictionary that can be used to create a disv grid (instead of a separate parent and child representation). The gridprops dictionary can be unpacked into the flopy.mf6.Modflowdisv() constructor and flopy.discretization.VertexGrid() constructor.
Note that export capability will only work if the parent and child models have corresponding layers.
- Returns:
gridprops – Dictionary containing ncpl, nvert, vertices, cell2d, nlay, top, and botm
- Return type:
- get_top()[source]
Construct a 1d array of size (ncpl) that contains the cell tops.
- Returns:
top – 1d array of top elevations
- Return type:
ndarray
- get_xcyc()[source]
Construct a 2d array of size (nvert, 2) that contains the cell centers.
- Returns:
xcyc – 2d array of x, y positions for cell centers
- Return type:
ndarray
- merge_hanging_vertices(ip, jp, ivlist)[source]
Given a list of vertices (ivlist) for parent row and column (ip, jp) merge hanging vertices from adjacent child cells into ivlist.
- Parameters:
- Returns:
ivlist – modified list of vertices that now also contains any hanging vertices needed to properly define a parent cell adjacent to child cells
- Return type:
list of ints
- class SimpleRegularGrid(nlay, nrow, ncol, delr, delc, top, botm, idomain, xorigin, yorigin)[source]
Bases:
objectSimple object for representing regular MODFLOW grid information.
- Parameters:
nlay (int) – number of layers
nrow (int) – number of rows
ncol (int) – number of columns
delr (ndarray) – delr array
delc (ndarray) – delc array
top (ndarray) – top array (nrow, ncol)
botm (ndarray) – botm array (nlay, nrow, ncol)
idomain (ndarray) – idomain array (nlay, nrow, ncol)
xorigin (float) – x location of grid lower left corner
yorigin (float) – y location of grid lower left corner
- property modelgrid