flopy.mfusg.mfusgoc module
mfusgoc module. Contains the MfusgOc class. Note that the user can access the MfusgOc class as flopy.mfusg.MfusgOc.
- class MfUsgOc(model, ihedfm=0, iddnfm=0, ispcfm=0, chedfm=None, cddnfm=None, cspcfm=None, cboufm=None, compact=True, stress_period_data={(0, 0): ['save head']}, extension=['oc', 'hds', 'ddn', 'cbc', 'ibo', 'con'], unitnumber=None, filenames=None, label='LABEL', **kwargs)[source]
Bases:
PackageMODFLOW USG Transport Output Control (OC) Package Class.
- Parameters:
model (model object) – The model object (of type
flopy.mfusg.MfUsg) to which this package will be added.ihedfm (int (default is 0)) – is a code for the format in which heads will be printed.
iddnfm (int (default is 0)) – is a code for the format in which drawdown will be printed.
chedfm (string (default is None)) – is a character value that specifies the format for saving heads.
cddnfm (string (default is None)) – is a character value that specifies the format for saving drawdown.
cboufm (string (default is None)) – is a character value that specifies the format for saving ibound.
stress_period_data (dictionary of lists) –
Dictionary key is a tuple with the zero-based period and step (IPEROC, ITSOC) for each print/save option list. If stress_period_data is None, then heads are saved for the last time step of each stress period. (default is None)
- The list can have any valid MFUSG OC print/save option:
PRINT HEAD PRINT DRAWDOWN PRINT BUDGET SAVE HEAD SAVE DRAWDOWN SAVE BUDGET SAVE IBOUND
The lists can also include (1) DDREFERENCE in the list to reset drawdown reference to the period and step and (2) a list of layers for PRINT HEAD, SAVE HEAD, PRINT DRAWDOWN, SAVE DRAWDOWN, and SAVE IBOUND.
stress_period_data = {(0,1):[‘save head’]}) would save the head for the second timestep in the first stress period.
compact (boolean) – Save results in compact budget form. (default is True).
extension (list of strings) – (default is [‘oc’, ‘hds’, ‘ddn’, ‘cbc’, ‘ibo’]).
unitnumber (list of ints) – (default is [14, 51, 52, 53, 0]).
Notes
The “words” method for specifying output control is the only option available. Also, the “compact” budget should normally be used as it produces files that are typically much smaller. The compact budget form is also a requirement for using the MODPATH particle tracking program.
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg() >>> spd = {(0, 0): ['print head'], ... (0, 1): [], ... (0, 249): ['print head'], ... (0, 250): [], ... (0, 499): ['print head', 'save ibound'], ... (0, 500): [], ... (0, 749): ['print head', 'ddreference'], ... (0, 750): [], ... (0, 999): ['print head']} >>> oc = flopy.mfusg.MfusgOc(m, stress_period_data=spd, cboufm='(20i5)')
- 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 string 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.
- Return type:
None
Examples
>>> import flopy >>> m = flopy.mfusg.MfUsg.load('model.nam') >>> m.oc.check()
- get_budgetunit()[source]
Get the budget file unit number(s).
- Parameters:
None –
- Returns:
iubud – Unit number or list of cell-by-cell budget output unit numbers. None is returned if ipakcb is less than one for all packages.
- Return type:
integer or list of integers
- static get_ocoutput_units(f, ext_unit_dict=None)[source]
Get head and drawdown units from a OC file.
- Parameters:
f (filename or file handle) – File to load.
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.
- Returns:
ihedun (integer) – Unit number of the head file.
fhead (str) – File name of the head file. Is only defined if ext_unit_dict is passed and the unit number is a valid key. , headfilename, oc : MfUsgOc object MfUsgOc object.
iddnun (integer) – Unit number of the drawdown file.
fddn (str) – File name of the drawdown file. Is only defined if ext_unit_dict is passed and the unit number is a valid key.
Examples
>>> import flopy >>> ihds, hf, iddn, df = flopy.mfusg.MfUsgOc.get_ocoutput_units('test.oc')
- classmethod load(f, model, nper=None, nstp=None, nlay=None, ext_unit_dict=None)[source]
Load an existing package.
- Parameters:
f (filename or file handle) – File to load.
model (model object) – The model object (of type
flopy.mfusg.MfUsg) to which this package will be added.nper (int) – The number of stress periods. If nper is None, then nper will be obtained from the model object. (default is None).
nstp (int or list of ints) – Integer of list of integers containing the number of time steps in each stress period. If nstp is None, then nstp will be obtained from the DIS or DISU packages attached to the model object. The length of nstp must be equal to nper. (default is None).
nlay (int) – The number of model layers. If nlay is None, then nnlay will be obtained from the model object. nlay only needs to be specified if an empty model object is passed in and the oc file being loaded is defined using numeric codes. (default is None).
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.
- Returns:
oc – MfUsgOc object.
- Return type:
MfUsgOc object
Examples
>>> import flopy >>> m = flopy.mfusg.Mfusg() >>> oc = flopy.mfusg.MfUsgOc.load('test.oc', m)
- reset_budgetunit(budgetunit=None, fname=None)[source]
Reset the cell-by-cell budget unit (ipakcb) for every package that can write cell-by-cell data when SAVE BUDGET is specified in the OC file to the specified budgetunit.
- Parameters:
budgetunit (int, optional) – Unit number for cell-by-cell output data. If budgetunit is None then the next available external unit number is assigned. Default is None
fname (string, optional) – Filename to use for cell-by-cell output file. If fname=None the cell-by-cell output file will be created using the model name and a ‘.cbc’ file extension. Default is None.
- Return type:
None