flopy.utils.mfgrdfile module¶
Module to read MODFLOW 6 binary grid files (*.grb) that define the model grid binary output files. The module contains the MfGrdFile class that can be accessed by the user.
-
class
MfGrdFile
(filename, precision='double', verbose=False)[source]¶ Bases:
flopy.utils.utils_def.FlopyBinaryData
The MfGrdFile class.
Parameters: - filename (str) – Name of the MODFLOW 6 binary grid file
- precision (string) – ‘single’ or ‘double’. Default is ‘double’.
- verbose (bool) – Write information to the screen. Default is False.
Notes
The MfGrdFile class provides simple ways to retrieve data from binary MODFLOW 6 binary grid files (.grb). The binary grid file contains data that can be used for post processing MODFLOW 6 model results.
Examples
>>> import flopy >>> gobj = flopy.utils.MfGrdFile('test.dis.grb')
-
get_centroids
()[source]¶ Get the centroids for a MODFLOW 6 GWF model that uses the DIS, DISV, or DISU discretization.
Returns: vertc – Array with x, y pairs of the centroid for every model cell Return type: np.ndarray Examples
>>> import flopy >>> gobj = flopy.utils.MfGrdFile('test.dis.grb') >>> vertc = gobj.get_centroids()
-
get_modelgrid
()[source]¶ Get the ModelGrid based on the MODFLOW 6 discretization type :returns: sr :rtype: SpatialReference
Examples
>>> import flopy >>> gobj = flopy.utils.MfGrdFile('test.dis.grb') >>> sr = gobj.get_modelgrid()
-
get_spatialreference
()[source]¶ Get the SpatialReference based on the MODFLOW 6 discretization type :returns: sr :rtype: SpatialReference
Examples
>>> import flopy >>> gobj = flopy.utils.MfGrdFile('test.dis.grb') >>> sr = gobj.get_spatialreference()
-
get_verts
()[source]¶ Get a list of the vertices that define each model cell and the x, y pair for each vertex.
Returns: - iverts (list of lists) – List with lists containing the vertex indices for each model cell.
- verts (np.ndarray) – Array with x, y pairs for every vertex used to define the model.
Examples
>>> import flopy >>> gobj = flopy.utils.MfGrdFile('test.dis.grb') >>> iverts, verts = gobj.get_verts()