flopy.discretization.grid module¶
-
class
Grid
(grid_type=None, top=None, botm=None, idomain=None, lenuni=None, epsg=None, proj4=None, prj=None, xoff=0.0, yoff=0.0, angrot=0.0)[source]¶ Bases:
object
Base class for a structured or unstructured model grid
Parameters: - grid_type (enumeration) – type of model grid (‘structured’, ‘vertex_layered’, ‘vertex_unlayered’)
- top (ndarray(np.float)) – top elevations of cells in topmost layer
- botm (ndarray(np.float)) – bottom elevations of all cells
- idomain (ndarray(np.int)) – ibound/idomain value for each cell
- lenuni (ndarray(np.int)) – model length units
- origin_loc (str) – Corner of the model grid that is the model origin ‘ul’ (upper left corner) or ‘ll’ (lower left corner)
- origin_x (float) – x coordinate of the origin point (lower left corner of model grid) in the spatial reference coordinate system
- origin_y (float) – y coordinate of the origin point (lower left corner of model grid) in the spatial reference coordinate system
- rotation (float) – rotation angle of model grid, as it is rotated around the origin point
-
grid_type
¶ type of model grid (‘structured’, ‘vertex_layered’, ‘vertex_unlayered’)
Type: enumeration
-
top
¶ top elevations of cells in topmost layer
Type: ndarray(np.float)
-
botm
¶ bottom elevations of all cells
Type: ndarray(np.float)
-
idomain
¶ ibound/idomain value for each cell
Type: ndarray(np.int)
-
proj4
¶ spatial reference locates the grid in a coordinate system
Type: proj4 SpatialReference
-
epsg
¶ spatial reference locates the grid in a coordinate system
Type: epsg SpatialReference
-
lenuni
¶ modflow lenuni parameter
Type: int
-
origin_x
¶ x coordinate of the origin point in the spatial reference coordinate system
Type: float
-
origin_y
¶ y coordinate of the origin point in the spatial reference coordinate system
Type: float
-
rotation
¶ rotation angle of model grid, as it is rotated around the origin point
Type: float
-
xgrid
¶ returns numpy meshgrid of x edges in reference frame defined by point_type
Type: ndarray
-
ygrid
¶ returns numpy meshgrid of y edges in reference frame defined by point_type
Type: ndarray
-
zgrid
¶ returns numpy meshgrid of z edges in reference frame defined by point_type
Type: ndarray
-
xcenters
¶ returns x coordinate of cell centers
Type: ndarray
-
ycenters
¶ returns y coordinate of cell centers
Type: ndarray
-
ycenters
returns z coordinate of cell centers
Type: ndarray
-
xyzgrid
¶ returns the location of grid edges of all model cells. if the model grid contains spatial reference information, the grid edges are in the coordinate system provided by the spatial reference information. returns a list of three ndarrays for the x, y, and z coordinates
Type: [ndarray, ndarray, ndarray]
-
xyzcellcenters
¶ returns the cell centers of all model cells in the model grid. if the model grid contains spatial reference information, the cell centers are in the coordinate system provided by the spatial reference information. otherwise the cell centers are based on a 0,0 location for the upper left corner of the model grid. returns a list of three ndarrays for the x, y, and z coordinates
Type: [ndarray, ndarray, ndarray]
-
get_coords
(x, y)[source]¶ transform point or array of points x, y from model coordinates to spatial coordinates
-
grid_lines : (point_type=PointType.spatialxyz) : list
returns the model grid lines in a list. each line is returned as a list containing two tuples in the format [(x1,y1), (x2,y2)] where x1,y1 and x2,y2 are the endpoints of the line.
-
xyvertices : (point_type) : ndarray
1D array of x and y coordinates of cell vertices for whole grid (single layer) in C-style (row-major) order (same as np.ravel())
Notes
Examples
-
angrot
¶
-
angrot_radians
¶
-
botm
-
epsg
-
extent
¶
-
get_coords
(x, y)[source] Given x and y array-like values, apply rotation, scale and offset, to convert them from model coordinates to real-world coordinates.
-
get_local_coords
(x, y)[source]¶ Given x and y array-like values, apply rotation, scale and offset, to convert them from real-world coordinates to model coordinates.
-
grid_lines
¶
-
grid_type
-
idomain
-
intersect
(x, y, local=False, forgive=False)[source]
-
is_complete
¶
-
is_valid
¶
-
lenuni
-
load_coord_info
(namefile=None, reffile='usgs.model.reference')[source]¶ Attempts to load spatial reference information from the following files (in order): 1) usgs.model.reference 2) NAM file (header comment) 3) defaults
-
nnodes
¶
-
prj
¶
-
proj4
-
read_usgs_model_reference_file
(reffile='usgs.model.reference')[source]¶ read spatial reference info from the usgs.model.reference file https://water.usgs.gov/ogw/policy/gw-model/modelers-setup.html
-
set_coord_info
(xoff=0.0, yoff=0.0, angrot=0.0, epsg=None, proj4=None, merge_coord_info=True)[source]¶
-
shape
¶
-
top
-
top_botm
¶
-
units
¶
-
xcellcenters
¶
-
xoffset
¶
-
xvertices
¶
-
xyzcellcenters
-
xyzextent
¶
-
xyzvertices
¶
-
ycellcenters
¶
-
yoffset
¶
-
yvertices
¶
-
zcellcenters
¶
-
zvertices
¶