flopy.mf6.mfbase module

class ExtFileAction[source]

Bases: enum.Enum

Defines what to do with external files when the simulation or model’s path change.

copy_all = 1
copy_none = 2
copy_relative_paths = 3
exception FlopyException(error, location='')[source]

Bases: Exception

General FloPy exception

exception MFDataException(model=None, package=None, path=None, current_process=None, data_element=None, method_caught_in=None, org_type=None, org_value=None, org_traceback=None, message=None, debug=None, mfdata_except=None)[source]

Bases: Exception

Exception with MODFLOW data. Exception includes detailed error information.

class MFFileMgmt(path, mfsim=None)[source]

Bases: object

Class containing MODFLOW path data

Parameters:path (str) – Path on disk to the simulation
model_relative_path

Dictionary of relative paths to each model folder

Type:OrderedDict
add_ext_file(file_path, model_name)[source]

Add an external file to the path list. For internal FloPy use, not intended for end user.

copy_files(copy_relative_only=True)[source]

Copy files external to updated path.

Parameters:copy_relative_only (bool) – Only copy files with relative paths.
get_model_path(key, last_loaded_path=False)[source]

Returns the model working path for the model key.

Parameters:
  • key (str) – Model name whose path flopy will retrieve
  • last_loaded_path (bool) – Get the last path loaded by FloPy which may not be the most recent path.
Returns:

model path

Return type:

str

get_sim_path(last_loaded_path=False)[source]

Get the simulation path.

get_updated_path(external_file_path, model_name, ext_file_action)[source]

For internal FloPy use, not intended for end user.

resolve_path(path, model_name, last_loaded_path=False, move_abs_paths=False)[source]

Resolve a simulation or model path. For internal FloPy use, not intended for end user.

set_last_accessed_model_path()[source]

Set the last accessed model path to the current model path. For internal FloPy use, not intended for end user.

set_last_accessed_path()[source]

Set the last accessed simulation path to the current simulation path. For internal FloPy use, not intended for end user.

set_sim_path(path, internal_use=False)[source]

Set the file path to the simulation files. Internal use only, call MFSimulation’s set_sim_path method instead.

Parameters:path (str) – Full path or relative path from working directory to simulation folder

Examples

self.simulation_data.mfdata.set_sim_path(‘sim_folder’)

static string_to_file_path(fp_string)[source]

Interpret string as a file path. For internal FloPy use, not intended for end user.

strip_model_relative_path(model_name, path)[source]

Strip out the model relative path part of path. For internal FloPy use, not intended for end user.

static unique_file_name(file_name, lookup)[source]

Generate a unique file name. For internal FloPy use, not intended for end user.

class MFFilePath(file_path, model_name)[source]

Bases: object

Class that stores a single file path along with the associated model name.

isabs()[source]
exception MFInvalidTransientBlockHeaderException(error)[source]

Bases: Exception

Exception occurs when parsing a transient block header

class PackageContainer(simulation_data, name)[source]

Bases: object

Base class for any class containing packages.

Parameters:
  • simulation_data (SimulationData) – The simulation’s SimulationData object
  • name (str) – Name of the package container object
package_type_dict

Dictionary of packages by package type

Type:dictionary
package_name_dict

Dictionary of packages by package name

Type:dictionary
package_key_dict

Dictionary of packages by package key

Type:dictionary
static get_module(package_file_path)[source]

Static method that returns the python module library. For internal FloPy use only, not intended for end users.

static get_module_val(module, item, attrb)[source]

Static method that returns a python class module value. For internal FloPy use only, not intended for end users.

get_package(name=None)[source]

Finds a package by package name, package key, package type, or partial package name. returns either a single package, a list of packages, or None.

Parameters:name (str) – Name of the package, ‘RIV’, ‘LPF’, etc.
Returns:pp
Return type:Package object
static get_package_file_paths()[source]

Static method that gets the paths of all the FloPy python package files. For internal FloPy use only, not intended for end users.

static model_factory(model_type)[source]

Static method that returns the appropriate model type object based on the model_type string. For internal FloPy use only, not intended for end users.

Parameters:model_type (str) – Type of model that package is a part of
Returns:model
Return type:MFModel subclass
package_dict

Returns a copy of the package name dictionary.

static package_factory(package_type, model_type)[source]

Static method that returns the appropriate package type object based on the package_type and model_type strings. For internal FloPy use only, not intended for end users.

Parameters:
  • package_type (str) – Type of package to create
  • model_type (str) – Type of model that package is a part of
Returns:

package

Return type:

MFPackage subclass

package_names

Returns a list of package names.

register_package(package)[source]

Base method for registering a package. Should be overridden.

class PackageContainerType[source]

Bases: enum.Enum

Determines whether a package container is a simulation, model, or package.

model = 2
package = 3
simulation = 1
exception ReadAsArraysException(error)[source]

Bases: Exception

Exception occurs when loading ReadAsArrays package as non-ReadAsArrays package.

exception StructException(error, location)[source]

Bases: Exception

Exception with the package file structure

class VerbosityLevel[source]

Bases: enum.Enum

Determines how much information FloPy writes to the console

normal = 2
quiet = 1
verbose = 3