flopy.utils.formattedfile module
Module to read MODFLOW formatted output files. The module contains one important classes that can be accessed by the user.
FormattedHeadFile (Formatted head file. Can also be used for drawdown)
- class FormattedHeadFile(filename, text='head', precision='single', verbose=False, **kwargs)[source]
Bases:
FormattedLayerFile
FormattedHeadFile Class.
- Parameters:
filename (string) – Name of the formatted head file
text (string) – Name of the text string in the formatted head file. Default is ‘head’
precision (string) – ‘single’ or ‘double’. Default is ‘single’.
verbose (bool) – Write information to the screen. Default is False.
Notes
The FormattedHeadFile class provides simple ways to retrieve 2d and 3d head arrays from a MODFLOW formatted head file and time series arrays for one or more cells.
The FormattedHeadFile class is built on a record array consisting of headers, which are record arrays of the modflow header information (kstp, kper, pertim, totim, text, nrow, ncol, ilay) and long integers, which are pointers to first bytes of data for the corresponding data array.
FormattedHeadFile can only read formatted head files containing headers. Use the LABEL option in the output control file to generate head files with headers.
Examples
>>> import flopy.utils.formattedfile as ff >>> hdobj = ff.FormattedHeadFile('model.fhd', precision='single') >>> hdobj.list_records() >>> rec = hdobj.get_data(kstpkper=(1, 50)) >>> rec2 = ddnobj.get_data(totim=100.)
- class FormattedHeader(text_ident, precision='single')[source]
Bases:
Header
The TextHeader class is a class to read in headers from MODFLOW formatted files.
- Parameters:
type (text_ident is the text string in the header that identifies the) –
point (of data (eg. 'head') precision is the precision of the floating) –
file (data in the) –
- class FormattedLayerFile(filename, precision, verbose, kwargs)[source]
Bases:
LayerFile
The FormattedLayerFile class is the super class from which specific derived classes are formed. This class should not be instantiated directly
- get_ts(idx)[source]
Get a time series from the formatted file.
- Parameters:
idx (tuple of ints, or a list of a tuple of ints) – idx can be (layer, row, column) or it can be a list in the form [(layer, row, column), (layer, row, column), …]. The layer, row, and column values must be zero based.
- Returns:
out – Array has size (ntimes, ncells + 1). The first column in the data array will contain time (totim).
- Return type:
numpy array
Notes
The layer, row, and column values must be zero-based, and must be within the following ranges: 0 <= k < nlay; 0 <= i < nrow; 0 <= j < ncol
Examples