flopy.modflowlgr.mflgr module

mf module. Contains the ModflowGlobal, ModflowList, and Modflow classes.

class LgrChild(ishflg=1, ibflg=59, iucbhsv=0, iucbfsv=0, mxlgriter=20, ioutlgr=1, relaxh=0.4, relaxf=0.4, hcloselgr=0.005, fcloselgr=0.05, nplbeg=0, nprbeg=0, npcbeg=0, nplend=0, nprend=1, npcend=1, ncpp=2, ncppl=1)[source]

Bases: object

class ModflowLgr(modelname='modflowlgrtest', namefile_ext='lgr', version='mflgr', exe_name='mflgr.exe', iupbhsv=0, iupbfsv=0, parent=None, children=None, children_data=None, model_ws='.', external_path=None, verbose=False, **kwargs)[source]

Bases: flopy.mbase.BaseModel

MODFLOW-LGR Model Class.

Parameters:
  • modelname (string, optional) – Name of model. This string will be used to name the MODFLOW input that are created with write_model. (the default is ‘modflowtest’)
  • namefile_ext (string, optional) – Extension for the namefile (the default is ‘nam’)
  • version (string, optional) – Version of MODFLOW to use (the default is ‘mf2005’).
  • exe_name (string, optional) – The name of the executable to use (the default is ‘mf2005’).
  • listunit (integer, optional) – Unit number for the list file (the default is 2).
  • model_ws (string, optional) – model workspace. Directory name to create model data sets. (default is the present working directory).
  • external_path (string) – Location for external files (default is None).
  • verbose (boolean, optional) – Print additional information to the screen (default is False).
  • load (boolean, optional) – (default is True).

Notes

Examples

>>> import flopy
>>> lgr = flopy.modflowlgr.ModflowLgr(parent=parent, children=children,
>>>                                   children_data=children_data)
change_model_ws(new_pth=None, reset_external=False)[source]

Change the model work space.

Parameters:new_pth (str) – Location of new model workspace. If this path does not exist, it will be created. (default is None, which will be assigned to the present working directory).
Returns:val – Can be used to see what packages are in the model, and can then be used with get_package to pull out individual packages.
Return type:list of strings
get_namefiles()[source]

Get the namefiles (with path) of the parent and children models

Returns:namefiles
Return type:list

Examples

>>> import flopy
>>> lgr = flopy.modflowlgr.ModflowLgr.load(f)
>>> namefiles = lgr.get_namefiles()
classmethod load(f, version='mflgr', exe_name='mflgr.exe', verbose=False, model_ws='.', load_only=None, forgive=False, check=True)[source]

Load an existing model.

Parameters:
  • f (filename or file handle) – MODFLOW name file to load.
  • model_ws (model workspace path) –
  • load_only ((optional) filetype(s) to load (e.g. ["bas6", "lpf"])) –
  • forgive (flag to raise exception(s) on package load failure - good for debugging) –
  • check (boolean) – Check model input for common errors. (default True)
Returns:

ml

Return type:

Modflow object

Examples

>>> import flopy
>>> ml = flopy.modflow.Modflow.load(f)
ngrids

Get the number of grids in the LGR model

Returns:ngrid – number of grids (parent and children)
Return type:int
write_input(SelPackList=False, check=False)[source]

Write the input. Overrides BaseModels’s write_input

Parameters:SelPackList (False or list of packages) –
write_name_file()[source]

Write the modflow-lgr control file.