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 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, irdflg=None, iptflg=None, extension='str', unitnumber=None, filenames=None, options=None, **kwargs)[source]

Bases: flopy.pakbase.Package

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)
  • irdflg (integer or dictionary) – is a integer or dictionary containing a integer flag, when positive suppresses printing of the stream input data for a stress period. If an integer is passed, all stress periods will use the same value. If a dictionary is passed, stress periods not in the dictionary will assigned a value of 1. Default is None which will assign a value of 1 to all stress periods.
  • iptflg (integer or dictionary) – is a integer or dictionary containing a integer flag, when positive suppresses printing of stream results for a stress period. If an integer is passed, all stress periods will use the same value. If a dictionary is passed, stress periods not in the dictionary will assigned a value of 1. Default is None which will assign a value of 1 to all stress periods.
  • 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 recarray. 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 recarray. 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. Auxiliary variables included as options should be constructed as options=[‘AUXILIARY IFACE’, ‘AUX xyx’]. Either ‘AUXILIARY’ or ‘AUX’ can be specified (case insensitive). (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 str output name will be created using the model name and .cbc the .sfr.bin/.sfr.out extensions (for example, modflowtest.cbc, and modflowtest.str.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 .str.bin/.str.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 str boundary will be
>>>                                         #applied to all stress periods
>>> str = flopy.modflow.ModflowStr(m, stress_period_data=strd)
static get_default_dtype(structured=True)[source]
static get_empty(ncells=0, nss=0, aux_names=None, structured=True)[source]
classmethod load(f, model, nper=None, ext_unit_dict=None)[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.
  • 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.

Return type:

ModflowStr object

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> strm = flopy.modflow.ModflowStr.load('test.str', m)
write_file()[source]

Write the package file.

Returns:
Return type:None