flopy.modflowlgr.mflgr module

mflgr module.

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', iupbhsv=0, iupbfsv=0, parent=None, children=None, children_data=None, model_ws='.', external_path=None, verbose=False, **kwargs)[source]

Bases: BaseModel

MODFLOW-LGR Model Class.

Parameters:
  • modelname (str, default "modflowlgrtest".) – Name of model. This string will be used to name the MODFLOW input that are created with write_model.

  • namefile_ext (str, default "lgr") – Extension for the namefile.

  • version (str, default "mflgr".) – Version of MODFLOW-LGR to use.

  • exe_name (str, default "mflgr") – The name of the executable to use.

  • iupbhsv (int, default 0) – Unit number with boundary heads.

  • iupbfsv (int, default 0) – Unit number with boundary fluxes.

  • parent (Modflow, optional) – Instance of a Modflow object.

  • children (list, optional) – List of instances of 1 or more Modflow objects.

  • children_data (list, optional) – List of LgrChild objects.

  • model_ws (str, default ".") – Model workspace. Directory name to create model data sets. Default is the present working directory.

  • external_path (str, optional) – Location for external files.

  • verbose (bool, default False) – Print additional information to the screen.

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', verbose=False, model_ws='.', load_only=None, forgive=False, check=True)[source]

Load an existing model.

Parameters:
  • f (str or file handle) – Path to MODFLOW-LGR name file to load.

  • version (str, default "mflgr".) – Version of MODFLOW-LGR to use.

  • exe_name (str, default "mflgr") – The name of the executable to use.

  • verbose (bool, default False) – Print additional information to the screen.

  • model_ws (str, default ".") – Model workspace. Directory name to create model data sets. Default is the present working directory.

  • load_only (list of str, optional) – Packages to load (e.g. [“bas6”, “lpf”]). Default None means that all packages will be loaded.

  • forgive (bool, default False) – Option to raise exceptions on package load failure, which can be useful for debugging.

  • check (bool, default True) – Check model input for common errors.

Return type:

flopy.modflowlgr.mflgr.ModflowLgr

property 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.