flopy.mf6.mfpackage module¶
-
class
MFBlock
(simulation_data, dimensions, structure, path, model_or_sim, container_package)[source]¶ Bases:
object
Represents a block in a MF6 input file
Parameters: - simulation_data (MFSimulationData) – data specific to this simulation
- dimensions (MFDimensions) – describes model dimensions including model grid and simulation time
- structure (MFVariableStructure) – structure describing block
- path (tuple) – unique path to block
-
block_headers
¶ block header text (BEGIN/END), header variables, comments in the header
Type: MFBlockHeaderIO
-
structure
¶ structure describing block
Type: MFBlockStructure
-
path
¶ unique path to block
Type: tuple
-
datasets
¶ dictionary of dataset objects with keys that are the name of the dataset
Type: OrderDict
-
datasets_keyword
¶ dictionary of dataset objects with keys that are key words to identify start of dataset
Type: dict
-
enabled
¶ block is being used
Type: boolean
-
get_block_header_info : (line : string, path : tuple)
static method that parses a line as a block header and returns a MFBlockHeader class representing the block header in that line
-
load : (block_header : MFBlockHeader, fd : file, strict : boolean)
loads block from file object. file object must be advanced to beginning of block before calling
-
write : (fd : file)
writes block to a file object
-
is_valid : ()
returns true of the block is valid
-
set_all_data_external : (base_name : string, check_data : boolean)
sets the block’s list and array data to be stored externally, base_name is external file name’s prefix, check_data determines if data error checking is enabled during this process
Notes
Examples
-
class
MFBlockHeader
(name, variable_strings, comment, simulation_data=None, path=None)[source]¶ Bases:
object
Represents the header of a block in a MF6 input file
Parameters: - name (string) – block name
- variable_strings (list) – list of strings that appear after the block name
- comment (MFComment) – comment text in the block header
-
name
¶ block name
Type: string
-
variable_strings
¶ list of strings that appear after the block name
Type: list
-
data_items
¶ list of MFVariable of the variables contained in this block
Type: list
-
write_header : (fd : file object)
writes block header to file object ‘fd’
-
write_footer : (fd : file object)
writes block footer to file object ‘fd’
-
build_header_variables
(simulation_data, block_header_structure, block_path, data, dimensions)[source]¶
-
class
MFChildPackages
(model, parent, pkg_type, filerecord, package=None, package_class=None)[source]¶ Bases:
object
-
class
MFPackage
(model_or_sim, package_type, filename=None, pname=None, loading_package=False, parent_file=None)[source]¶ Bases:
flopy.mf6.mfbase.PackageContainer
,flopy.pakbase.PackageInterface
Provides an interface for the user to specify data to build a package.
Parameters: - model_or_sim (MFModel of MFSimulation) – the parent model or simulation containing this package
- package_type (string) – string defining the package type
- filename (string) – filename of file where this package is stored
- pname (string) – package name
- loading_package (bool) – whether or not to add this package to the parent container’s package list during initialization
- parent_file (MFPackage) – parent package that contains this package
-
blocks
¶ dictionary of blocks contained in this package by block name
Type: OrderedDict
-
path
¶ data dictionary path to this package
Type: tuple
-
structure
¶ describes the blocks and data contain in this package
Type: PackageStructure
-
dimensions
¶ resolves data dimensions for data within this package
Type: PackageDimension
-
build_mfdata : (var_name : variable name, data : data contained in this
- object) : MFData subclass
- Returns the appropriate data type object (mfdatalist, mfdataarray, or mfdatascalar) giving that object the appropriate structure (looked up based on var_name) and any data supplied
-
load : (strict : bool) : bool
Loads the package from file
-
is_valid : bool
Returns whether or not this package is valid
-
get_file_path : string
Returns the package file’s path
-
set_all_data_external : (check_data : boolean)
sets the package’s list and array data to be stored externally, check_data determines if data error checking is enabled during this process
Notes
Examples
-
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 sting 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.
- checktype (check) – Checker type to be used. By default class check is used from check.py.
Returns: Return type: None
Examples
>>> import flopy >>> m = flopy.modflow.Modflow.load('model.nam') >>> m.dis.check()
-
data_list
¶
-
export
(f, **kwargs)[source]¶ Method to export a package to netcdf or shapefile based on the extension of the file name (.shp for shapefile, .nc for netcdf)
Parameters: - f (str) – filename
- kwargs (keyword arguments) –
- modelgrid : flopy.discretization.Grid instance
- user supplied modelgrid which can be used for exporting in lieu of the modelgrid associated with the model object
Returns: Return type: None or Netcdf object
-
filename
¶
-
name
¶
-
package_type
¶
-
parent
¶
-
plot
(**kwargs)[source]¶ Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data
Parameters: - package (flopy.pakbase.Package instance supplied for plotting) –
- **kwargs (dict) –
- filename_base : str
- Base file name that will be used to automatically generate file names for output image files. Plots will be exported as image files if file_name_base is not None. (default is None)
- file_extension : str
- Valid matplotlib.pyplot file extension for savefig(). Only used if filename_base is not None. (default is ‘png’)
- mflay : int
- MODFLOW zero-based layer number to return. If None, then all all layers will be included. (default is None)
- kper : int
- MODFLOW zero-based stress period number to return. (default is zero)
- key : str
- MfList dictionary key. (default is None)
Returns: axes – Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis are returned.
Return type: list
-
plotable
¶
-
remove
()[source]
-
write
(ext_file_action=<ExtFileAction.copy_relative_paths: 3>)[source]