flopy.modflow.mfpar module

mfpar module. Contains the ModflowPar class. Note that the user can access the ModflowPar class as flopy.modflow.ModflowPar.

class ModflowPar[source]

Bases: object

Class for loading mult, zone, pval, and parameter data for MODFLOW packages that use array data (LPF, UPW, RCH, EVT). Class also includes methods to create data arrays using mult, zone, pval, and parameter data (not used for boundary conditions).

Notes

Parameters are supported in Flopy only when reading in existing models. Parameter values are converted to native values in Flopy and the connection to “parameters” is thus nonexistent.

static load(f, npar, verbose=False)[source]

Load property parameters from an existing package.

Parameters:
  • f (file handle) –
  • npar (int) – The number of parameters.
  • verbose (bool) – Boolean flag to control output. (default is False)
Returns:

  • list (list object of unique par_types in file f)
  • dictionary (dictionary object with parameters in file f)

Examples

>>>par_types, parm_dict = flopy.modflow.mfpar.ModflowPar.load(f, np)

static parameter_fill(model, shape, findkey, parm_dict, findlayer=None)[source]

Fill an array with parameters using zone, mult, and pval data.

Parameters:
  • model (model object) – The model object (of type flopy.modflow.mf.Modflow) to which this package will be added.
  • shape (tuple) – The shape of the returned data array. Typically shape is (nrow, ncol)
  • findkey (string) – the parameter array to be constructed,
  • parm_dict (dict) – dictionary that includes all of the parameter data for a package
  • findlayer (int) – Layer that will be filled. Not required for array boundary condition data.
Returns:

data – Filled array resulting from applications of zone, mult, pval, and parameter data.

Return type:

numpy array

Examples

for lpf and upw:

>>> data = flopy.modflow.mfpar.ModflowPar.parameter_fill(m, (nrow, ncol), 'vkcb',
>>> .....................................................parm_dict, findlayer=1)
set_mult(model, ext_unit_dict)[source]

Load an existing mult package and set mult data for a model.

Parameters:
  • 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.

Examples

>>> ml.mfpar.set_mult(ml, ext_unit_dict)
set_pval(model, ext_unit_dict)[source]

Load an existing pval package and set pval data for a model.

Parameters:
  • 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.

Examples

>>> ml.mfpar.set_pval(ml, ext_unit_dict)
set_zone(model, ext_unit_dict)[source]

Load an existing zone package and set zone data for a model.

Parameters:
  • 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.

Examples

>>> ml.mfpar.set_zone(ml, ext_unit_dict)