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. This class is used internally by FloPy and use by users of the FloPy library is not recommended.
- 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:
- structure
Structure describing block
- Type:
- 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:
- data_factory(sim_data, model_or_sim, structure, enable, path, dimensions, data=None, package=None)[source]
Creates the appropriate data child object derived from MFData.
- is_allowed()[source]
Determine if block is valid based on the values of dependant MODFLOW variables.
- load(block_header, fd, strict=True)[source]
Loads block from file object. file object must be advanced to beginning of block before calling.
- Parameters:
block_header (MFBlockHeader) – Block header for block block being loaded.
fd (file) – File descriptor of file being loaded
strict (bool) – Enforce strict MODFLOW 6 file format.
- set_all_data_external(base_name, check_data=True, external_data_folder=None)[source]
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.
- set_all_data_internal(check_data=True)[source]
Sets the block’s list and array data to be stored internally, check_data determines if data error checking is enabled during this process.
- Parameters:
check_data (bool) – Whether to do data error checking.
- class MFBlockHeader(name, variable_strings, comment, simulation_data=None, path=None, block=None)[source]
Bases:
object
Represents the header of a block in a MF6 input file. This class is used internally by FloPy and its direct use by a user of this library is not recommend.
- Parameters:
- build_header_variables(simulation_data, block_header_structure, block_path, data, dimensions)[source]
Builds data objects to hold header variables.
- connect_to_dict(simulation_data, path, comment=None)[source]
Add comment to the simulation dictionary
Writes block footer to file object fd.
- Parameters:
fd (file object) – File object to write block footer to.
- class MFChildPackages(model_or_sim, parent, pkg_type, filerecord, package=None, package_class=None)[source]
Bases:
object
Behind the scenes code for creating an interface to access child packages from a parent package. This class is automatically constructed by the FloPy library and is for internal library use only.
- class MFPackage(parent, package_type, filename=None, pname=None, loading_package=False, **kwargs)[source]
Bases:
PackageContainer
,PackageInterface
Provides an interface for the user to specify data to build a package.
- Parameters:
parent (MFModel, MFSimulation, or MFPackage) – The parent model, simulation, or package containing this package
package_type (str) – String defining the package type
filename (str or PathLike) – Name or path of file where this package is stored
quoted_filename (str) – Filename with quotes around it when there is a space in the name
pname (str) – Package name
loading_package (bool) – Whether or not to add this package to the parent container’s package list during initialization
- structure
Describes the blocks and data contain in this package
- Type:
PackageStructure
- dimensions
Resolves data dimensions for data within this package
- Type:
PackageDimension
- build_child_package(pkg_type, data, parameter_name, filerecord)[source]
Builds a child package. This method is only intended for FloPy internal use.
- build_child_packages_container(pkg_type, filerecord)[source]
Builds a container object for any child packages. This method is only intended for FloPy internal use.
- build_mfdata(var_name, data=None)[source]
Returns the appropriate data type object (mfdatalist, mfdataarray, or mfdatascalar) given that object the appropriate structure (looked up based on var_name) and any data supplied. This method is for internal FloPy library use only.
- Parameters:
var_name (str) – Variable name
data (many supported types) – Data contained in this object
- Returns:
data object
- Return type:
MFData subclass
- create_package_dimensions()[source]
Creates a package dimensions object. For internal FloPy library use.
- Returns:
package dimensions
- Return type:
- property data_list
List of data in this package.
- 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) –
- modelgridflopy.discretization.Grid instance
User supplied modelgrid which can be used for exporting in lieu of the modelgrid associated with the model object
- Return type:
None or Netcdf object
- property filename
Package’s file name.
- inspect_cells(cell_list, stress_period=None)[source]
Inspect model cells. Returns package data associated with cells.
- Parameters:
- Returns:
output – Array containing inspection results
- Return type:
array
- property name
Name of package
- property output
Method to get output associated with a specific package
- Return type:
MF6Output object
- property package_type
String describing type of package
- property parent
Parent package
- plot(**kwargs)[source]
Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) package input data
- Parameters:
**kwargs (dict) –
- filename_basestr
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_extensionstr
Valid matplotlib.pyplot file extension for savefig(). Only used if filename_base is not None. (default is ‘png’)
- mflayint
MODFLOW zero-based layer number to return. If None, then all all layers will be included. (default is None)
- kperint
MODFLOW zero-based stress period number to return. (default is zero)
- keystr
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:
- property plottable
If package is plottable
- property quoted_filename
Package’s file name with quotes if there is a space.
- set_all_data_external(check_data=True, external_data_folder=None)[source]
Sets the package’s list and array data to be stored externally.
- Parameters:
check_data (bool) – Determine if data error checking is enabled
external_data_folder – Folder where external data will be stored
- set_all_data_internal(check_data=True)[source]
Sets the package’s list and array data to be stored internally.
- Parameters:
check_data (bool) – Determine if data error checking is enabled
- set_model_relative_path(model_ws)[source]
Sets the model path relative to the simulation’s path.
- Parameters:
model_ws (str) – Model path relative to the simulation’s path.
- write(ext_file_action=ExtFileAction.copy_relative_paths)[source]
Writes the package to a file.
- Parameters:
ext_file_action (ExtFileAction) – How to handle pathing of external data files.