flopy.modflow.mfstr Module

mfstr module. Contains the ModflowStr class. Note that the user can access the ModflowStr class as flopy.modflow.ModflowStr.

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

class flopy.modflow.mfstr.ModflowStr(model, mxacts=0, nss=0, ntrib=0, ndiv=0, icalc=0, const=86400.0, ipakcb=None, istcb2=None, dtype=None, stress_period_data=None, segment_data=None, extension='str', unitnumber=None, filenames=None, options=None, **kwargs)

MODFLOW Stream Package Class.

Parameters:

model : model object

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

mxacts : int

Maximum number of stream reaches that will be in use during any stress period. (default is 0)

nss : int

Number of stream segments. (default is 0)

ntrib : int

The number of stream tributaries that can connect to one segment. The program is currently dimensioned so that NTRIB cannot exceed 10. (default is 0)

ndiv : int

A flag, which when positive, specifies that diversions from segments are to be simulated. (default is 0)

icalc : int

A flag, which when positive, specifies that stream stages in reaches are to be calculated. (default is 0)

const : float

Constant value used in calculating stream stage in reaches whenever ICALC is greater than 0. This constant is 1.486 for flow units of cubic feet per second and 1.0 for units of cubic meters per second. The constant must be multiplied by 86,400 when using time units of days in the simulation. If ICALC is 0, const can be any real value. (default is 86400.)

ipakcb : int

A flag that is used to determine if cell-by-cell budget data should be saved. If ipakcb is non-zero cell-by-cell budget data will be saved. (default is 0).

istcb2 : int

A flag that is used flag and a unit number for the option to store streamflow out of each reach in an unformatted (binary) file. If istcb2 is greater than zero streamflow data will be saved. (default is None).

dtype : tuple, list, or numpy array of numpy dtypes

is a tuple, list, or numpy array containing the dtype for datasets 6 and 8 and the dtype for datasets 9 and 10 data in stress_period_data and segment_data dictionaries. (default is None)

stress_period_data : dictionary of reach data

Each dictionary contains a list of str reach data for a stress period.

Each stress period in the dictionary data contains data for datasets 6 and 8.

The value for stress period data for a stress period can be an integer (-1 or 0), a list of lists, a numpy array, or a numpy recarry. If stress period data for a stress period contains an integer, a -1 denotes data from the previous stress period will be reused and a 0 indicates there are no str reaches for this stress period.

Otherwise stress period data for a stress period should contain mxacts or fewer rows of data containing data for each reach. Reach data are specified through definition of layer (int), row (int), column (int), segment number (int), sequential reach number (int), flow entering a segment (float), stream stage (float), streambed hydraulic conductance (float), streambed bottom elevation (float), streambed top elevation (float), stream width (float), stream slope (float), roughness coefficient (float), and auxiliary variable data for auxiliary variables defined in options (float).

If icalc=0 is specified, stream width, stream slope, and roughness coefficients, are not used and can be any value for each stress period. If data are specified for dataset 6 for a given stress period and icalc>0, then stream width, stream slope, and roughness coefficients should be appropriately set.

The simplest form is a dictionary with a lists of boundaries for each stress period, where each list of boundaries itself is a list of boundaries. Indices of the dictionary are the numbers of the stress period. For example, if mxacts=3 this gives the form of:

stress_period_data =
{0: [
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough],
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough],
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough]]
    ],
1:  [
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough],
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough],
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough]]
    ], ...
kper:
    [
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough],
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough],
    [lay, row, col, seg, reach, flow, stage, cond, sbot, stop, width, slope, rough]]
    ]
}

segment_data : dictionary of str segment data

Each dictionary contains a list of segment str data for a stress period.

Each stress period in the dictionary data contains data for datasets 9, and 10. Segment data for a stress period are ignored if a integer value is specified for stress period data.

The value for segment data for a stress period can be an integer (-1 or 0), a list of lists, a numpy array, or a numpy recarry. If segment data for a stress period contains an integer, a -1 denotes data from the previous stress period will be reused and a 0 indicates there are no str segments for this stress period.

Otherwise stress period data for a stress period should contain nss rows of data containing data for each segment. Segment data are specified through definition of itrib (int) data for up to 10 tributaries and iupseg (int) data.

If ntrib=0 is specified, itrib values are not used and can be any value for each stress period. If data are specified for dataset 6 for a given stress period and ntrib>0, then itrib data should be specified for columns 0:ntrib.

If ndiv=0 is specified, iupseg values are not used and can be any value for each stress period. If data are specified for dataset 6 for a given stress period and ndiv>0, then iupseg data should be specified for the column in the dataset [10].

The simplest form is a dictionary with a lists of boundaries for each stress period, where each list of boundaries itself is a list of boundaries. Indices of the dictionary are the numbers of the stress period. For example, if nss=2 and ntrib>0 and/or ndiv>0 this gives the form of:

segment_data =
{0: [
    [itrib1, itrib2, itrib3, itrib4, itrib5, itrib6, itrib7, itrib8, itrib9, itrib10, iupseg],
    [itrib1, itrib2, itrib3, itrib4, itrib5, itrib6, itrib7, itrib8, itrib9, itrib10, iupseg],
    ],
1:  [
    [itrib1, itrib2, itrib3, itrib4, itrib5, itrib6, itrib7, itrib8, itrib9, itrib10, iupseg],
    [itrib1, itrib2, itrib3, itrib4, itrib5, itrib6, itrib7, itrib8, itrib9, itrib10, iupseg],
    ], ...
kper:
    [
    [itrib1, itrib2, itrib3, itrib4, itrib5, itrib6, itrib7, itrib8, itrib9, itrib10, iupseg],
    [itrib1, itrib2, itrib3, itrib4, itrib5, itrib6, itrib7, itrib8, itrib9, itrib10, iupseg],
    ]
}

options : list of strings

Package options. (default is None).

extension : string

Filename extension (default is ‘str’)

unitnumber : int

File unit number (default is None).

filenames : str or list of str

Filenames to use for the package and the output files. If filenames=None the package name will be created using the model name and package extension and the cbc output and sfr output name will be created using the model name and .cbc the .sfr.bin/.sfr.out extensions (for example, modflowtest.cbc, and modflowtest.sfr.bin), if ipakcbc and istcb2 are numbers greater than zero. If a single string is passed the package will be set to the string and cbc and sf routput names will be created using the model name and .cbc and .sfr.bin/.sfr.out extensions, if ipakcbc and istcb2 are numbers greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 3. Default is None.

Notes

Parameters are not supported in FloPy.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> strd = {}
>>> strd[0] = [[2, 3, 4, 15.6, 1050., -4]]  #this river boundary will be
>>>                                         #applied to all stress periods
>>> str8 = flopy.modflow.ModflowStr(m, stress_period_data=strd)
check(f=None, verbose=True, level=1)

Check package data for common errors.

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()
static load(f, model, nper=None, ext_unit_dict=None)

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.

nper : int

The number of stress periods. If nper is None, then nper will be obtained from the model object. (default is None).

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.

Returns:

str : ModflowStr object

ModflowStr object.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> strm = flopy.modflow.ModflowStr.load('test.str', 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()
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()

Write the package file.

Returns:None