flopy.mf6.utils.binarygrid_util 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: 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 standard output. 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. For example, the ia and ja arrays for a model grid.

Examples

>>> import flopy
>>> gobj = flopy.utils.MfGrdFile('test.dis.grb')
property angrot

Model grid rotation angle. None if not defined in the MODFLOW 6 grid file.

Returns:

angrot

Return type:

float

property bot

Bottom of the model cells.

Returns:

bot

Return type:

ndarray of floats

property cell2d

cell2d data for a DISV grid. None for DIS and DISU grids.

Returns:

cell2d

Return type:

list of lists

property cellcenters

Cell centers (x,y).

Returns:

cellcenters

Return type:

ndarray of floats

property delc

Cell size in the column direction (x-direction). None if not defined in the MODFLOW 6 grid file.

Returns:

delc

Return type:

ndarray of floats

property delr

Cell size in the row direction (y-direction). None if not defined in the MODFLOW 6 grid file.

Returns:

delr

Return type:

ndarray of floats

property grid_type

Grid type defined in the MODFLOW 6 grid file.

Returns:

grid_type

Return type:

str

property ia

index array that defines indexes for .ja. Each ia value is the starting position of data for a cell. [ia[n]:ia[n+1]] would give you all data for a cell. ia[n] is also the location of data for the diagonal position. See .ja property documentation for an example of getting a cell’s number and connected cells

Returns:

ia

Return type:

ndarray of ints

property iavert

index array that defines indexes for .javart. Each ia value is the starting position of data for a cell. [iavert[n]:iavert[n+1]] would give you all data for a cell. See .javert property documentation for an example of getting cell number and it’s vertex numbers. Alternatively, the .iverts property can be used to get this information

Returns:

iavert

Return type:

ndarray of ints or None for structured grids

property idomain

IDOMAIN for the model grid. None if not defined in the MODFLOW 6 grid file.

Returns:

idomain

Return type:

ndarray of ints

property iverts

Vertex numbers comprising each cell for every cell in model grid.

Returns:

iverts

Return type:

list of lists of ints

property ja

Flat jagged connection array for a model. .ja for a cell includes the cell number and the cell number for all connected cells. Indexes for cells are stored in the .ia variable.

Returns:

ja

Return type:

ndarray of ints

Examples

>>> from flopy.mf6.utils import MfGrdFile
>>> grb = MfGrdFile("my_model.dis.grb")
>>> ia = grb.ia
>>> ja = grb.ja
>>> # get connections for node 0
>>> ja_node0 = ja[ia[0]:ia[1]]
>>> node = ja_node0[0]
>>> connections = ja_node0[1:]
property javert

Flat jagged array of vertex numbers that comprise all of the cells

Returns:

javerts

Return type:

ndarray of ints or None for structured grids

Examples

>>> from flopy.mf6.utils import MfGrdFile
>>> grb = MfGrdFile("my_model.dis.grb")
>>> iavert = self.iavert
>>> javert = self.javert
>>> # get vertex numbers for node 0
>>> vertnums = javert[iavert[0]:iavert[1]]
property modelgrid

Model grid object.

Returns:

modelgrid

Return type:

StructuredGrid, VertexGrid, UnstructuredGrid

property ncells

Number of cells.

Returns:

ncells

Return type:

int

property ncol

Number of columns. None for DISV and DISU grids.

Returns:

ncol

Return type:

int

property ncpl

Number of cells per layer. None for DISU grids.

Returns:

ncpl

Return type:

int

property nja

Number of non-zero entries JA vector array.

Returns:

nja

Return type:

int

property nlay

Number of layers. None for DISU grids.

Returns:

nlay

Return type:

int

property nodes

Number of nodes.

Returns:

nodes

Return type:

int

property nrow

Number of rows. None for DISV and DISU grids.

Returns:

nrow

Return type:

int

property shape

Shape of the model grid (tuple).

Returns:

shape

Return type:

tuple

property top

Top of the model cells in the upper model layer for DIS and DISV grids. Top of the model cells for DISU grids.

Returns:

top

Return type:

ndarray of floats

property verts

x,y location of each vertex that defines the model grid.

Returns:

verts

Return type:

ndarray of floats

property xorigin

x-origin of the model grid. None if not defined in the MODFLOW 6 grid file.

Returns:

xorigin

Return type:

float

property yorigin

y-origin of the model grid. None if not defined in the MODFLOW 6 grid file.

Returns:

yorigin

Return type:

float