flopy.utils.mfreadnam Module

mfreadnam module. Contains the NamData class. Note that the user can access the NamData class as flopy.modflow.NamData.

Additional information about the MODFLOW name file can be found at the Online MODFLOW Guide.

class flopy.utils.mfreadnam.NamData(pkgtype, name, handle, packages)

MODFLOW Namefile Class.

Parameters:

pkgtype : string

String identifying the type of MODFLOW package. See the mfnam_packages dictionary keys in the model object for a list of supported packages. This dictionary is also passed in as packages.

name : string

Filename of the package file identified in the name file

handle : file handle

File handle referring to the file identified by name

packages : dictionary

Dictionary of package objects as defined in the mfnam_packages attribute of flopy.modflow.mf.Modflow.

Attributes

filehandle (file handle) File handle to the package file. Read from handle.
filename (string) Filename of the package file identified in the name file. Read from name.
filetype (string) String identifying the type of MODFLOW package. Read from pkgtype.
package (string) Package type. Only assigned if pkgtype is found in the keys of packages
flopy.utils.mfreadnam.getfiletypeunit(nf, filetype)

Method to return unit number of a package from a NamData instance

Parameters:

nf : NamData instance

filetype : string, name of package seeking information for

Returns:

cunit : int, unit number corresponding to the package type

flopy.utils.mfreadnam.parsenamefile(namfilename, packages, verbose=True)

Function to parse the nam file and return a dictionary with types, names, units and handles

Parameters:

namefilename : string

Name of the MODFLOW namefile to parse.

packages : dictionary

Dictionary of package objects as defined in the mfnam_packages attribute of flopy.modflow.mf.Modflow.

verbose : logical

Print messages to screen. Default is True.

Returns:

ext_unit_dict : dictionary

For each file listed in the name file, a flopy.utils.mfreadnam.NamData instance is stored in the ext_unit_dict dictionary keyed by unit number