flopy.mf6.data.mfstructure module
mfstructure module. Contains classes related to package structure
- class BlockType(value)[source]
Bases:
Enum
Types of blocks that can be found in a package file
- multiple = 2
- single = 1
- transient = 3
- class DataType(value)[source]
Bases:
Enum
Types of data that can be found in a package file
- array = 3
- array_transient = 4
- list = 5
- list_multiple = 7
- list_transient = 6
- scalar = 2
- scalar_keyword = 1
- scalar_keyword_transient = 9
- scalar_transient = 8
- class DatumType(value)[source]
Bases:
Enum
Types of individual pieces of data
- constant = 5
- double_precision = 3
- integer = 2
- keystring = 7
- keyword = 1
- list_defined = 6
- recarray = 10
- record = 8
- repeating_record = 9
- string = 4
- class Dfn[source]
Bases:
object
Base class for package file definitions
- dfndir
folder containing package definition files (dfn)
- Type:
path
- common
file containing common information
- Type:
path
- get_file_list : () : list
returns all of the dfn files found in dfndir. files are returned in a specified order defined in the local variable file_order
Notes
Examples
- class DfnFile(file)[source]
Bases:
Dfn
Dfn child class that loads dfn information from a package definition (dfn) file
- dict_by_name : {} : dict
returns a dictionary of data item descriptions from the dfn file with the data item name as the dictionary key
- get_block_structure_dict : (path : tuple, common : bool, model_file :
bool) : dict
returns a dictionary of block structure information for the package
Notes
Examples
- class DfnPackage(package)[source]
Bases:
Dfn
Dfn child class that loads dfn information from a list structure stored in the auto-built package classes
- get_block_structure_dict : (path : tuple, common : bool, model_file :
bool) : dict
returns a dictionary of block structure information for the package
Notes
Examples
- class DfnType(value)[source]
Bases:
Enum
An enumeration.
- common = 1
- exch_file = 5
- gnc_file = 8
- ims_file = 4
- model_file = 7
- model_name_file = 6
- mvr_file = 9
- mvt_file = 11
- sim_name_file = 2
- sim_tdis_file = 3
- unknown = 999
- utl = 10
- class MFBlockStructure(name, path, model_block, parent_package)[source]
Bases:
object
Defines the structure of a MF6 block.
- Parameters:
- name
block name
- Type:
string
- path
tuple that describes location of block within simulation (<model>, <package>, <block>)
- Type:
- data_structures
dictionary of data items in this block, with the data item name as the key
- Type:
- repeating() : bool
Returns true if more than one instance of this block can appear in a MF6 package file
- add_dataset(dataset: MFDataStructure, block_header_dataset: bool)[source]
Adds dataset to this block, as a header dataset of block_header_dataset is true
- number_non_optional_data() : int
Returns the number of non-optional non-header data structures in this block
- number_non_optional_block_header_data() : int
Returns the number of non-optional block header data structures in this block
- get_data_structure(path : tuple) : MFDataStructure
Returns the data structure in this block with name defined by path[0]. If name does not exist, returns None.
- get_all_recarrays() : list
Returns all data non-header data structures in this block that are of type recarray
Notes
Examples
- class MFDataItemStructure[source]
Bases:
object
Defines the structure of a single MF6 data item in a dfn file
- name_list
list of alternate names for the data item, includes data item’s main name “name”
- Type:
- python_name
name of data item referenced in python, with illegal python characters removed
- Type:
- type_obj
type of the data item as a python type
- Type:
python type
- valid_values
list of valid values for the data item. if empty, this constraint does not apply
- Type:
- tagged
whether data item is tagged. if the data item is tagged its name is included in the MF6 input file
- Type:
- just_data
when just_data is true only data appears in the MF6 input file. otherwise, name information appears
- Type:
- layer_dims
which dimensions in the shape function as layers, if None defaults to “layer”
- Type:
- reader
reader that MF6 uses to read the data
- Type:
basestring
- optional
whether data item is optional or required as part of the MFData in the MF6 input file
- Type:
- path
a tuple describing the data item’s location within the simulation (<model>,<package>,<block>,<data>)
- Type:
- block_type
whether the block containing this item is a single non-repeating block, a multiple repeating block, or a transient repeating block
- Type:
- keystring_dict
dictionary containing acceptable keystrings if this data item is of type keystring
- Type:
- remove_cellid : (resolved_shape : list, cellid_size : int)
removes the cellid size from the shape of a data item
- set_path : (path : tuple)
sets the path to this data item to path
- get_rec_type : () : object type
gets the type of object of this data item to be used in a numpy recarray
Notes
Examples
- class MFDataStructure(data_item, model_data, package_type, dfn_list)[source]
Bases:
object
Defines the structure of a single MF6 data item in a dfn file
- Parameters:
data_item (MFDataItemStructure) – base data item associated with this data structure
model_data (bool) – whether or not this is part of a model
package_type (str) – abbreviated package type
- path
a tuple describing the data’s location within the simulation (<model>,<package>,<block>,<data>)
- Type:
- optional
whether data is optional or required as part of the MFBlock in the MF6 input file
- Type:
- num_data_items
number of data item structures contained in this MFDataStructure, including itself
- Type:
- record_within_record
true if this MFDataStructure is a record within a container MFDataStructure
- Type:
- block_type
whether the block containing this data is a single non-repeating block, a multiple repeating block, or a transient repeating block
- Type:
- parent_block
parent block structure object
- Type:
- get_keywords : () : list
returns a list of all keywords associated with this data
- supports_aux : () : bool
returns true of this data supports aux variables
- add_item : (item : MFDataItemStructure, record : bool)
adds a data item to this MFDataStructure
- set_path : (path : tuple)
sets the path describing the data’s location within the simulation (<model>,<package>,<block>,<data>)
- get_datatype : () : DataType
returns the DataType of this data (array, list, scalar, …)
- get_min_record_entries : () : int
gets the minimum number of entries, as entered in a package file, for a single record. excludes optional data items
- get_record_size : () : int
gets the number of data items, excluding keyword data items, in this MFDataStructure
- all_keywords : () : bool
returns true of all data items are keywords
- get_type_string : () : str
returns descriptive string of the data types in this MFDataStructure
- get_description : () : str
returns a description of the data
- get_type_array : (type_array : list):
builds an array of data type information in type_array
- get_datum_type : (numpy_type : bool):
returns the object type of the first data item in this MFDataStructure with a standard type. if numpy_type is true returns the type as a numpy type
- get_data_item_types: () : list
returns a list of object type for every data item in this MFDataStructure
- first_non_keyword_index : () : int
return the index of the first data item in this MFDataStructure that is not a keyword
Notes
Examples
- property is_mname
- class MFInputFileStructure(dfn_file, path, common, model_file)[source]
Bases:
object
MODFLOW Input File Stucture class. Loads file structure information for individual input file types.
- Parameters:
dfn_file (string) – the definition file used to define the structure of this input file
path (tuple) – path defining the location of the container of this input file structure within the overall simulation structure
common (bool) – is this the common dfn file
model_file (bool) – this file belongs to a specific model type
- path
path defining the location of this input file structure within the overall simulation structure
- Type:
- is_valid() : bool
Checks all structures objects within the file for validity
- get_data_structure(path: string)[source]
Returns a data structure of it exists, otherwise returns None. Data structure type returned is based on the tuple/list “path”
Notes
Examples
- class MFModelStructure(model_type, utl_struct_objs)[source]
Bases:
object
Defines the structure of a MF6 model and its packages
- Parameters:
model_type (string) – abbreviation of model type
- name_file_struct_obj
describes the structure of the simulation name file
- Type:
- model_type
dictionary containing simulation package structure
- Type:
string
- add_namefile : (dfn_file : DfnFile, model_file=True : bool)
Adds a namefile structure object to the model
- add_package(dfn_file : DfnFile, model_file=True : bool)[source]
Adds a package structure object to the model
- is_valid() : bool
Checks all structures objects within the model for validity
- get_data_structure(path: string)[source]
Returns a data structure of it exists, otherwise returns None. Data structure type returned is based on the tuple/list “path”
Notes
Examples
- class MFSimulationStructure[source]
Bases:
object
Defines the structure of a MF6 simulation and its packages and models.
- name_file_struct_obj
describes the structure of the simulation name file
- Type:
- model_type
placeholder
- Type:
string
- process_dfn : (dfn_file : DfnFile)
reads in the contents of a dfn file, storing that contents in the appropriate object
- add_namefile : (dfn_file : DfnFile, model_file=True : bool)
Adds a namefile structure object to the simulation
- add_util : (dfn_file : DfnFile)
Adds a utility package structure object to the simulation
- add_package(dfn_file : DfnFile, model_file=True : bool)[source]
Adds a package structure object to the simulation
- is_valid() : bool
Checks all structures objects within the simulation for validity
- get_data_structure(path: string)[source]
Returns a data structure of it exists, otherwise returns None. Data structure type returned is based on the tuple/list “path”
- tag_read_as_arrays()[source]
Searches through all packages and tags any packages with a name that indicates they are the READASARRAYS version of a package.
Notes
Examples
- property model_types
- class MFStructure(internal_request=False, load_from_dfn_files=False)[source]
Bases:
object
Singleton class for accessing the contents of the json structure file (only one instance of this class can exist, which loads the json file on initialization)
- Parameters:
mf_version (int) – version of MODFLOW
valid (bool) – whether the structure information loaded from the dfn files is valid
sim_struct (MFSimulationStructure) – Object containing file structure for all simulation files
dimension_dict (dict) – Dictionary mapping paths to dimension information to the dataitem whose dimension information is being described