flopy.modflow.mfgage module

mfgage module. Contains the ModflowGage class. Note that the user can access the ModflowGage class as flopy.modflow.ModflowGage.

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

class ModflowGage(model, numgage=0, gage_data=None, files=None, extension='gage', unitnumber=None, filenames=None, **kwargs)[source]

Bases: flopy.pakbase.Package

MODFLOW Gage Package Class.

Parameters:
  • model (model object) – The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.
  • numgage (int) – The total number of gages included in the gage file (default is 0).
  • gage_data (list or numpy array) – data for dataset 2a and 2b in the gage package. If a list is provided then the list includes 2 to 3 entries (LAKE UNIT [OUTTYPE]) for each LAK Package entry and 4 entries (GAGESEG GAGERCH UNIT OUTTYPE) for each SFR Package entry. If a numpy array it passed each gage location must have 4 entries, where LAK Package gages can have any value for the second column. The numpy array can be created using the get_empty() method available in ModflowGage. Default is None
  • files (list of strings) – Names of gage output files. A file name must be provided for each gage. If files are not provided and filenames=None then a gage name will be created using the model name and the gage number (for example, modflowtest.gage1.go). Default is None.
  • extension (string) – Filename extension (default is ‘gage’)
  • 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 gage output names will be created using the model name and the gage number (for example, modflowtest.gage1.go). If a single string is passed the package will be set to the string and gage output names will be created using the model name and the gage number. To define the names for all gage files (input and output) the length of the list of strings should be numgage + 1. Default is None.

Notes

Parameters are not supported in FloPy.

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> gages = [[-1,  -26, 1], [-2,  -27, 1]]
>>> files = ['gage1.go', 'gage2.go']
>>> gage = flopy.modflow.ModflowGage(m, numgage=2,
>>>                                  gage_data=gages, files=files)
static get_default_dtype()[source]
static get_empty(ncells=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()
>>> gage = flopy.modflow.ModflowGage.load('test.gage', m)
write_file()[source]

Write the package file.

Returns:
Return type:None