flopy.modflow.mfbas module

mfbas module. Contains the ModflowBas class. Note that the user can access the ModflowBas class as flopy.modflow.ModflowBas.

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

class ModflowBas(model, ibound=1, strt=1.0, ifrefm=True, ixsec=False, ichflg=False, stoper=None, hnoflo=-999.99, extension='bas', unitnumber=None, filenames=None)[source]

Bases: flopy.pakbase.Package

MODFLOW Basic Package Class.

Parameters:
  • model (model object) – The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.
  • ibound (array of ints, optional) – The ibound array (the default is 1).
  • strt (array of floats, optional) – An array of starting heads (the default is 1.0).
  • ifrefm (bool, optional) – Indication if data should be read using free format (the default is True).
  • ixsec (bool, optional) – Indication of whether model is cross sectional or not (the default is False).
  • ichflg (bool, optional) – Flag indicating that flows between constant head cells should be calculated (the default is False).
  • stoper (float) – percent discrepancy that is compared to the budget percent discrepancy continue when the solver convergence criteria are not met. Execution will unless the budget percent discrepancy is greater than stoper (default is None). MODFLOW-2005 only
  • hnoflo (float) – Head value assigned to inactive cells (default is -999.99).
  • extension (str, optional) – File extension (default is ‘bas’).
  • unitnumber (int, optional) – FORTRAN unit number for this package (default is None).
  • filenames (str or list of str) – Filenames to use for the package. If filenames=None the package name will be created using the model name and package extension. If a single string is passed the package name will be set to the string. Default is None.
heading

Text string written to top of package input file.

Type:str
options

Can be either or a combination of XSECTION, CHTOCH or FREE.

Type:list of str
ifrefm

Indicates whether or not packages will be written as free format.

Type:bool

Notes

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> bas = flopy.modflow.ModflowBas(m)
check(f=None, verbose=True, level=1, checktype=None)[source]

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:

Return type:

None

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow.load('model.nam')
>>> m.bas6.check()
ifrefm
classmethod load(f, model, ext_unit_dict=None, check=True, **kwargs)[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.
  • 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.
  • check (boolean) – Check package data for common errors. (default True)
  • kwargs (dictionary) – Keyword arguments that are passed to load. Possible keyword arguments are nlay, nrow, and ncol. If not provided, then the model must contain a discretization package with correct values for these parameters.
Returns:

bas – ModflowBas object (of type flopy.modflow.ModflowBas)

Return type:

ModflowBas object

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> bas = flopy.modflow.ModflowBas.load('test.bas', m, nlay=1, nrow=10,
>>>                                     ncol=10)
write_file(check=True)[source]

Write the package file.

Parameters:check (boolean) – Check package data for common errors. (default True)
Returns:
Return type:None