flopy.modflow.mfhob module

class HeadObservation(model, tomulth=1.0, obsname='HOBS', layer=0, row=0, column=0, irefsp=None, roff=0.0, coff=0.0, itt=1, mlay=None, time_series_data=None, names=None)[source]

Bases: object

Create single HeadObservation instance from a time series array. A list of HeadObservation instances are passed to the ModflowHob package.

Parameters:
  • tomulth (float) – Time-offset multiplier for head observations. Default is 1.
  • obsname (string) – Observation name. Default is ‘HOBS’
  • layer (int) – The zero-based layer index of the cell in which the head observation is located. If layer is less than zero, hydraulic heads from multiple layers are combined to calculate a simulated value. The number of layers equals the absolute value of layer, or abs(layer). Default is 0.
  • row (int) – The zero-based row index for the observation. Default is 0.
  • column (int) – The zero-based column index of the observation. Default is 0.
  • irefsp (int) – The zero-based stress period to which the observation time is referenced.
  • roff (float) – Fractional offset from center of cell in Y direction (between rows). Default is 0.
  • coff (float) – Fractional offset from center of cell in X direction (between columns). Default is 0.
  • itt (int) – Flag that identifies whether head or head changes are used as observations. itt = 1 specified for heads and itt = 2 specified if initial value is head and subsequent changes in head. Only specified if irefsp is < 0. Default is 1.
  • mlay (dictionary of length (abs(irefsp))) – Key represents zero-based layer numbers for multilayer observations and value represents the fractional value for each layer of multilayer observations. If mlay is None, a default mlay of {0: 1.} will be used (default is None).
  • time_series_data (list or numpy array) – Two-dimensional list or numpy array containing the simulation time of the observation and the observed head [[totim, hob]]. If time_series_dataDefault is None, a default observation of 0. at totim 0. will be created (default is None).
  • names (list) – List of specified observation names. If names is None, observation names will be automatically generated from obsname and the order of the timeseries data (default is None).
Returns:

obs – HeadObservation object.

Return type:

HeadObservation

Examples

>>> import flopy
>>> model = flopy.modflow.Modflow()
>>> dis = flopy.modflow.ModflowDis(model, nlay=1, nrow=11, ncol=11, nper=2,
...                                perlen=[1,1])
>>> tsd = [[1.,54.4], [2., 55.2]]
>>> obsdata = flopy.modflow.HeadObservation(model, layer=0, row=5,
...                                         column=5, time_series_data=tsd)
class ModflowHob(model, iuhobsv=None, hobdry=0, tomulth=1.0, obs_data=None, hobname=None, extension='hob', no_print=False, options=None, unitnumber=None, filenames=None)[source]

Bases: flopy.pakbase.Package

Head Observation package class

Parameters:
  • iuhobsv (int) – unit number where output is saved. If iuhobsv is None, a unit number will be assigned (default is None).
  • hobdry (float) – Value of the simulated equivalent written to the observation output file when the observation is omitted because a cell is dry (default is 0).
  • tomulth (float) – Time step multiplier for head observations. The product of tomulth and toffset must produce a time value in units consistent with other model input. tomulth can be dimensionless or can be used to convert the units of toffset to the time unit used in the simulation (default is 1).
  • obs_data (HeadObservation or list of HeadObservation instances) – A single HeadObservation instance or a list of HeadObservation instances containing all of the data for each observation. If obs_data is None a default HeadObservation with an observation in layer, row, column (0, 0, 0) and a head value of 0 at totim 0 will be created (default is None).
  • hobname (str) – Name of head observation output file. If iuhobsv is greater than 0, and hobname is None, the model basename with a ‘.hob.out’ extension will be used (default is None).
  • extension (string) – Filename extension (default is hob)
  • no_print (boolean) – When True or 1, a list of head observations will not be written to the Listing File (default is False)
  • options (list of strings) – Package options (default is None).
  • unitnumber (int) – File unit number (default is None)
  • filenames (str or list of str) – Filenames to use for the package and the output files. If filenames is None the package name will be created using the model name and package extension and the hob output name will be created using the model name and .hob.out extension (for example, modflowtest.hob.out), if iuhobsv is a number greater than zero. If a single string is passed the package will be set to the string and hob output name will be created using the model name and .hob.out extension, if iuhobsv is a number greater than zero. To define the names for all package files (input and output) the length of the list of strings should be 2. Default is None.

See also

Notes

Examples

>>> import flopy
>>> model = flopy.modflow.Modflow()
>>> dis = flopy.modflow.ModflowDis(model, nlay=1, nrow=11, ncol=11, nper=2,
...                                perlen=[1,1])
>>> tsd = [[1.,54.4], [2., 55.2]]
>>> obsdata = flopy.modflow.HeadObservation(model, layer=0, row=5,
...                                         column=5, time_series_data=tsd)
>>> hob = flopy.modflow.ModflowHob(model, iuhobsv=51, hobdry=-9999.,
...                                obs_data=obsdata)
classmethod load(f, model, ext_unit_dict=None, check=True)[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)
Returns:

hob – ModflowHob package object.

Return type:

ModflowHob package object

Examples

>>> import flopy
>>> m = flopy.modflow.Modflow()
>>> hobs = flopy.modflow.ModflowHob.load('test.hob', m)
write_file()[source]

Write the package file

Returns:
Return type:None