flopy.modflow.mfdis Module

mfdis module. Contains the ModflowDis class. Note that the user can access the ModflowDis class as flopy.modflow.ModflowDis.

Additional information for this MODFLOW package can be found at the Online MODFLOW Guide.

class flopy.modflow.mfdis.ModflowDis(model, nlay=1, nrow=2, ncol=2, nper=1, delr=1.0, delc=1.0, laycbd=0, top=1, botm=0, perlen=1, nstp=1, tsmult=1, steady=True, itmuni=4, lenuni=2, extension='dis', unitnumber=None, filenames=None, xul=None, yul=None, rotation=0.0, proj4_str=None, start_datetime=None)

MODFLOW Discretization Package Class.

Parameters:

model : model object

The model object (of type flopy.modflow.Modflow) to which this package will be added.

nlay : int

Number of model layers (the default is 1).

nrow : int

Number of model rows (the default is 2).

ncol : int

Number of model columns (the default is 2).

nper : int

Number of model stress periods (the default is 1).

delr : float or array of floats (ncol), optional

An array of spacings along a row (the default is 1.0).

delc : float or array of floats (nrow), optional

An array of spacings along a column (the default is 0.0).

laycbd : int or array of ints (nlay), optional

An array of flags indicating whether or not a layer has a Quasi-3D confining bed below it. 0 indicates no confining bed, and not zero indicates a confining bed. LAYCBD for the bottom layer must be 0. (the default is 0)

top : float or array of floats (nrow, ncol), optional

An array of the top elevation of layer 1. For the common situation in which the top layer represents a water-table aquifer, it may be reasonable to set Top equal to land-surface elevation (the default is 1.0)

botm : float or array of floats (nlay, nrow, ncol), optional

An array of the bottom elevation for each model cell (the default is 0.)

perlen : float or array of floats (nper)

An array of the stress period lengths.

nstp : int or array of ints (nper)

Number of time steps in each stress period (default is 1).

tsmult : float or array of floats (nper)

Time step multiplier (default is 1.0).

steady : boolean or array of boolean (nper)

true or False indicating whether or not stress period is steady state (default is True).

itmuni : int

Time units, default is days (4)

lenuni : int

Length units, default is meters (2)

extension : string

Filename extension (default is ‘dis’)

unitnumber : int

File unit number (default is None).

filenames : str or list of str

Filenames to use for the package. If filenames=None the package name will be created using the model name and package extension. If a single string is passed the package will be set to the string. Default is None.

xul : float

x coordinate of upper left corner of the grid, default is None

yul : float

y coordinate of upper left corner of the grid, default is None

rotation : float

clockwise rotation (in degrees) of the grid about the upper left corner. default is 0.0

proj4_str : str

PROJ4 string that defines the xul-yul coordinate system (.e.g. ‘+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ‘). Can be an EPSG code (e.g. ‘EPSG:4326’). Default is ‘EPSG:4326’

start_dateteim : str

starting datetime of the simulation. default is ‘1/1/1970’

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> dis = flopy.modflow.ModflowDis(m)

Attributes

heading (str) Text string written to top of package input file.
check(f=None, verbose=True, level=1)

Check dis package data for zero and negative thicknesses.

Parameters:

f : str or file handle

String defining file name or file handle for summary file of check method output. If a sting is passed a file handle is created. If f is None, check method does not write results to a summary file. (default is None)

verbose : bool

Boolean flag used to determine if check method results are written to the screen

level : int

Check method analysis level. If level=0, summary checks are performed. If level=1, full checks are performed.

Returns:

None

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow.load('model.nam')
>>> m.dis.check()
checklayerthickness()

Check layer thickness.

get_cell_volumes()

Get an array of cell volumes.

Returns:vol : array of floats (nlay, nrow, ncol)
get_final_totim()

Get the totim at the end of the simulation

Returns:

totim: float

maximum simulation totim

get_kstp_kper_toffset(t=0.0)

Get the stress period, time step, and time offset from passed time.

Parameters:

t : float

totim to return the stress period, time step, and toffset for based on time discretization data. Default is 0.

Returns:

kstp : int

time step in stress period corresponding to passed totim

kper : int

stress period corresponding to passed totim

toffset : float

time offset of passed totim from the beginning of kper

get_lrc(nodes)

Get layer, row, column from a list of MODFLOW node numbers.

Returns:

v : list of tuples containing the layer (k), row (i),

and column (j) for each node in the input list

get_node(lrc_list)

Get node number from a list of MODFLOW layer, row, column tuples.

Returns:

v : list of MODFLOW nodes for each layer (k), row (i),

and column (j) tuple in the input list

get_node_coordinates()

Get y, x, and z cell centroids.

Returns:

y : list of cell y-centroids

x : list of cell x-centroids

z : array of floats (nlay, nrow, ncol)

get_totim()

Get the totim at the end of each time step

Returns:

totim: numpy array

numpy array with simulation totim at the end of each time step

get_totim_from_kper_toffset(kper=0, toffset=0.0)

Get totim from a passed kper and time offset from the beginning of a stress period

Parameters:

kper : int

stress period. Default is 0

toffset : float

time offset relative to the beginning of kper

Returns:

t : float

totim to return the stress period, time step, and toffset for based on time discretization data. Default is 0.

getbotm(k=None)

Get the bottom array.

Returns:

botm : array of floats (nlay, nrow, ncol), or

botm : array of floats (nrow, ncol) if k is not none

gettop()

Get the top array.

Returns:top : array of floats (nrow, ncol)
static load(f, model, ext_unit_dict=None, check=True)

Load an existing package.

Parameters:

f : filename or file handle

File to load.

model : model object

The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.

ext_unit_dict : dictionary, optional

If the arrays in the file are specified using EXTERNAL, or older style array control records, then f should be a file handle. In this case ext_unit_dict is required, which can be constructed using the function flopy.utils.mfreadnam.parsenamefile.

check : boolean

Check package data for common errors. (default True)

Returns:

dis : ModflowDis object

ModflowDis object.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> dis = flopy.modflow.ModflowDis.load('test.dis', m)
plot(**kwargs)

Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data

Parameters:

**kwargs : dict

filename_base
: str

Base file name that will be used to automatically generate file names for output image files. Plots will be exported as image files if file_name_base is not None. (default is None)

file_extension
: str

Valid matplotlib.pyplot file extension for savefig(). Only used if filename_base is not None. (default is ‘png’)

mflay
: int

MODFLOW zero-based layer number to return. If None, then all all layers will be included. (default is None)

kper
: int

MODFLOW zero-based stress period number to return. (default is zero)

key
: str

MfList dictionary key. (default is None)

Returns:

axes : list

Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis are returned.

Examples

>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.dis.plot()
read_from_cnf(cnf_file_name, n_per_line=0)

Read discretization information from an MT3D configuration file.

thickness

Get a Util3d array of cell thicknesses.

Returns:thickness : util3d array of floats (nlay, nrow, ncol)
to_shapefile(filename, **kwargs)

Export 2-D, 3-D, and transient 2-D model data to shapefile (polygons). Adds an attribute for each layer in each data array

Parameters:

filename : str

Shapefile name to write

Returns:

None

Examples

>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> ml.lpf.to_shapefile('test_hk.shp')
write_file(check=True)

Write the package file.

Parameters:

check : boolean

Check package data for common errors. (default True)

Returns:

None

flopy.modflow.mfdis.get_layer(dis, i, j, elev)

Return the layer for an elevation at an i, j location.

Parameters:

dis : flopy.modflow.ModflowDis object

i : row index (zero-based)

j : column index

elev : elevation (in same units as model)

Returns:

k : zero-based layer index