flopy.mf6.data.mfdatastorage module¶
-
class
DataStorage(sim_data, model_or_sim, data_dimensions, get_file_entry, data_storage_type=<DataStorageType.internal_array: 1>, data_structure_type=<DataStructureType.ndarray: 1>, layer_shape=(1, ), layered=False, stress_period=0, data_path=())[source]¶ Bases:
objectStores and retrieves data.
Parameters: - sim_data (simulation data class) – reference to the simulation data class
- data_dimensions (data dimensions class) – a data dimensions class for the data being stored
- get_file_entry (method reference) – method that returns the file entry for the stored data
- data_storage_type (enum) – how the data will be stored (internally, as a constant, as an external file)
- data_structure_type (enum) – what internal type is the data stored in (ndarray, recarray, scalar)
- layer_shape (int) – number of data layers
- layered (boolean) – is the data layered
- layer_storage (MultiList<LayerStorage>) – one or more dimensional list of LayerStorage
-
data_storage_type¶ list of data storage types, one for each layer
Type: list
-
data_const_value¶ list of data constants, one for each layer
Type: list
-
external_file_path¶ list of external file paths, one for each layer
Type: list
-
multiplier¶ list of multipliers, one for each layer
Type: list
-
print_format¶ list of print formats, one for each layer
Type: list
-
data_structure_type¶ what internal type is the data stored in (ndarray, recarray, scalar)
-
layered¶ is the data layered
Type: boolean
-
pre_data_comments¶ any comments before the start of the data
Type: string
-
comments¶ any comments mixed in with the data, dictionary keys are data lines
Type: OrderedDict
-
post_data_comments¶ any comments after the end of the data
Type: string
-
override_data_type : (index, data_type) overrides the data type used in a recarray at index “index” with data type “data_type”
-
get_const_val(layer)[source]¶ gets the constant value of a given layer. data storage type for layer must be “internal_constant”.
-
has_data(layer) : boolean returns true if data exists for the specified layer, false otherwise
-
get_data(layer) : ndarray/recarray/string returns the data for the specified layer
-
update_item(data, key_index)¶ updates the data in a recarray at index “key_index” with data “data”. data is a list containing all data for a single record in the recarray. . data structure type must be recarray
-
append_data(data)[source]¶ appends data “data” to the end of a recarray. data structure type must be recarray
-
set_data(data, layer=None, multiplier=[1.0] sets the data being stored to “data” for layer “layer”, replacing all data for that layer. a multiplier can be specified.
-
get_active_layer_indices() : list returns the indices of all layers expected to contain data
-
store_internal(data, layer=None, const=False, multiplier=[1.0])[source]¶ store data “data” at layer “layer” internally
-
store_external(file_path, layer=None, multiplier=[1.0], print_format=None, data=None, do_not_verify=False) store data “data” at layer “layer” externally in file “file_path”
-
external_to_external(new_external_file, multiplier=None, layer=None)[source]¶ copies existing external data to the new file location and points to the new file
-
external_to_internal(layer_num=None, store_internal=False) : - ndarray/recarray
- loads existing external data for layer “layer_num” and returns it. if store_internal is True it also storages the data internally, changing the storage type for “layer_num” layer to internal.
-
internal_to_external(new_external_file, multiplier=None, layer=None, - print_format=None)
stores existing internal data for layer “layer” to external file “new_external_file”
-
read_data_from_file(layer, fd=None, multiplier=None) : (ndarray, int)¶ reads in data from a given file “fd” as data from layer “layer”. returns data as an ndarray along with the size of the data
-
to_string(val, type, is_cellid=False, possible_cellid=False)¶ converts data “val” of type “type” to a string. is_cellid is True if the data type is known to be a cellid and is treated as such. when possible_cellid is True the data is checked to see if it matches the shape/dimensions of a cellid before using it as one.
-
resolve_data_size(index) : int resolves the size of a given data element in a recarray based on the names in the existing rec_array. assumes repeating data element names follow the format <data_element_name>_X. returns the number of times the data element repeats.
Notes
Examples
-
append_data(data)[source]
-
build_type_list(data_set=None, data=None, resolve_data_shape=True, key=None, nseg=None, cellid_expanded=False)[source]¶
-
external_to_external(new_external_file, multiplier=None, layer=None, binary=None)[source]
-
flatten()[source]
-
get_const_val(layer=None)[source]
-
get_external_file_path(layer)[source]
-
internal_to_external(new_external_file, multiplier=None, layer=None, print_format=None, binary=False)[source]¶
-
make_layered()[source]
-
store_external(file_path, layer=None, multiplier=None, print_format=None, data=None, do_not_verify=False, binary=False)[source]¶
-
store_internal(data, layer=None, const=False, multiplier=None, key=None, autofill=False, print_format=None)[source]
-
class
DataStorageType[source]¶ Bases:
enum.EnumEnumeration of different ways that data can be stored
-
external_file= 3¶
-
internal_array= 1¶
-
internal_constant= 2¶
-
-
class
DataStructureType[source]¶ Bases:
enum.EnumEnumeration of different data structures used to store data
-
ndarray= 1¶
-
recarray= 2¶
-
scalar= 3¶
-
-
class
LayerStorage(data_storage, lay_indexes, data_storage_type=<DataStorageType.internal_array: 1>, data_type=None)[source]¶ Bases:
objectStores a single layer of data.
Parameters: - data_storage (DataStorage) – Parent data storage object that layer is contained in
- lay_num (int) – Layer number of layered being stored
- data_storage_type (DataStorageType) – Method used to store the data
-
internal_data¶ data being stored, if full data is being stored internally in memory
Type: ndarray or recarray
-
data_const_value¶ constant value of data being stored, if data is a constant
Type: int/float
-
data_storage_type¶ method used to store the data
Type: DataStorageType
-
fname¶ file name of external file containing the data
Type: str
-
factor¶ factor to multiply the data by
Type: int/float
-
iprn¶ print code
Type: int
-
binary¶ whether the data is stored in a binary file
Type: bool
-
get_const_val(layer)¶ gets the constant value of a given layer. data storage type for layer must be “internal_constant”.
-
get_data(layer) : ndarray/recarray/string returns the data for the specified layer
-
set_data(data, layer=None, multiplier=[1.0] sets the data being stored to “data” for layer “layer”, replacing all data for that layer. a multiplier can be specified.
Notes
Examples
-
name¶