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 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=None, proj4_str=None, start_datetime=None)[source]¶
Bases:
flopy.pakbase.Package
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 (bool or array of bool (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, which means xul will be set to zero.
yul (float) – y coordinate of upper-left corner of the grid, default is None, which means yul will be calculated as the sum of the delc array. This default, combined with the xul and rotation defaults will place the lower-left corner of the grid at (0, 0).
rotation (float) – counter-clockwise rotation (in degrees) of the grid about the lower- left corner. default is 0.0
proj4_str (str) – PROJ4 string that defines the projected coordinate system (e.g. ‘+proj=utm +zone=14 +datum=WGS84 +units=m +no_defs ‘). Can be an EPSG code (e.g. ‘EPSG:32614’). Default is None.
start_datetime (str) – starting datetime of the simulation. default is ‘1/1/1970’
- heading¶
Text string written to top of package input file.
- Type
str
Notes
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> dis = flopy.modflow.ModflowDis(m)
- check(f=None, verbose=True, level=1, checktype=None)[source]¶
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.
- Return type
None
Examples
>>> import flopy >>> m = flopy.modflow.Modflow.load('model.nam') >>> m.dis.check()
- get_cell_volumes()[source]¶
Get an array of cell volumes.
- Returns
vol
- Return type
array of floats (nlay, nrow, ncol)
- get_final_totim()[source]¶
Get the totim at the end of the simulation
- Returns
totim – maximum simulation totim
- Return type
float
- get_kstp_kper_toffset(t=0.0, use_cached_totim=False)[source]¶
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.
use_cached_totim (bool) – optional flag to use a cached calculation of totim, vs. dynamically calculating totim. Setting to True significantly speeds up looped operations that call this function (default is False).
- 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_layer(i, j, elev)[source]¶
Return the layer for an elevation at an i, j location.
- Parameters
i (row index (zero-based)) –
j (column index) –
elev (elevation (in same units as model)) –
- Returns
k
- Return type
zero-based layer index
- get_lrc(nodes)[source]¶
Get zero-based layer, row, column from a list of zero-based MODFLOW node numbers.
- Returns
v – and column (j) for each node in the input list
- Return type
list of tuples containing the layer (k), row (i),
- get_node(lrc_list)[source]¶
Get zero-based node number from a list of zero-based MODFLOW layer, row, column tuples.
- Returns
v – and column (j) tuple in the input list
- Return type
list of MODFLOW nodes for each layer (k), row (i),
- get_node_coordinates()[source]¶
Get y, x, and z cell centroids in local model coordinates.
- Returns
y (list of cell y-centroids)
x (list of cell x-centroids)
z (array of floats (nlay, nrow, ncol))
- get_rc_from_node_coordinates(x, y, local=True)[source]¶
Get the row and column of a point or sequence of points in model coordinates.
- Parameters
x (float or sequence of floats) – x coordinate(s) of points to find in model grid
y (float or sequence floats) – y coordinate(s) of points to find in model grid
local (bool) – x and y coordinates are in model local coordinates. If false, then x and y are in world coordinates. (default is True)
- Returns
r (row or sequence of rows (zero-based))
c (column or sequence of columns (zero-based))
- get_totim(use_cached=False)[source]¶
Get the totim at the end of each time step
- Parameters
use_cached (bool) – method to use cached totim values instead of calculating totim dynamically
- Returns
totim – numpy array with simulation totim at the end of each time step
- Return type
numpy array
- get_totim_from_kper_toffset(kper=0, toffset=0.0, use_cached_totim=False)[source]¶
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
use_cached_totim (bool) – optional flag to use a cached calculation of totim, vs. dynamically calculating totim. Setting to True significantly speeds up looped operations that call this function (default is False).
- Returns
t – totim to return the stress period, time step, and toffset for based on time discretization data. Default is 0.
- Return type
float
- getbotm(k=None)[source]¶
Get the bottom array.
- Returns
botm (array of floats (nlay, nrow, ncol), or)
botm (array of floats (nrow, ncol) if k is not none)
- classmethod load(f, model, ext_unit_dict=None, check=True)[source]¶
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 (bool) – Check package data for common errors. (default True)
- Returns
dis – ModflowDis object.
- Return type
ModflowDis object
Examples
>>> import flopy >>> m = flopy.modflow.Modflow() >>> dis = flopy.modflow.ModflowDis.load('test.dis', m)
- write_file(check=True)[source]¶
Write the package file.
- Parameters
check (bool) – Check package data for common errors. (default True)
- Return type
None
- property zcentroids¶
- get_layer(dis, i, j, elev)[source]¶
Return the layers for elevations at i, j locations.
- Parameters
dis (flopy.modflow.ModflowDis object) –
i (scaler or sequence) – row index (zero-based)
j (scaler or sequence) – column index
elev (scaler or sequence) – elevation (in same units as model)
- Returns
k – zero-based layer index
- Return type
np.ndarray (1-D) or scalar