flopy.mf6.data.mfdataarray module¶
-
class
MFArray
(sim_data, model_or_sim, structure, data=None, enable=True, path=None, dimensions=None)[source]¶ Bases:
flopy.mf6.data.mfdata.MFMultiDimVar
Provides an interface for the user to access and update MODFLOW array data.
Parameters: - sim_data (MFSimulationData) – data contained in the simulation
- structure (MFDataStructure) – describes the structure of the data
- data (list or ndarray) – actual data
- enable (bool) – enable/disable the array
- path (tuple) – path in the data dictionary to this MFArray
- dimensions (MFDataDimensions) – dimension information related to the model, package, and array
-
plotable
¶ if the scalar is plotable
Type: bool
-
dtype
¶ the scalar’s numpy data type
Type: numpy.dtype
-
data
¶ calls get_data with default parameters
Type: variable
-
new_simulation : (sim_data : MFSimulationData)
initialize MFArray object for a new simulation
-
supports_layered : bool
Returns whether this MFArray supports layered data
-
set_layered_data : (layered_data : bool)
Sets whether this MFArray supports layered data
-
store_as_external_file : (external_file_path : string, layer_num : int,
- replace_existing_external : bool)
Stores data from layer “layer_num” to an external file at “external_file_path”. For unlayered data do not pass in “layer”. If layer is not specified all layers will be stored with each layer as a separate file. If replace_existing_external is set to False, this method will not do anything if the data is already in an external file.
-
store_as_internal_array : (multiplier : float, layer_num : int)
Stores data from layer “layer_num” internally within the MODFLOW file with a multiplier “multiplier”. For unlayered data do not pass in “layer”.
-
has_data : (layer_num : int) : bool
Returns whether layer “layer_num” has any data associated with it. For unlayered data do not pass in “layer”.
-
get_data : (layer_num : int) : ndarray
Returns the data associated with layer “layer_num”. If “layer_num” is None, returns all data.
-
set_data : (data : ndarray/list, multiplier : float, layer_num : int)
Sets the contents of the data at layer “layer_num” to “data” with multiplier “multiplier”. For unlayered data do not pass in “layer_num”. data can have the following formats: 1) ndarray - numpy ndarray containing all of the data 2) [data] - python list containing all of the data 3) val - a single constant value to be used for all of the data 4) {‘filename’:filename, ‘factor’:fct, ‘iprn’:print, ‘data’:data} - dictionary defining external file information 5) {‘data’:data, ‘factor’:fct, ‘iprn’:print) - dictionary defining internal information. Data that is layered can also be set by defining a list with a length equal to the number of layers in the model. Each layer in the list contains the data as defined in the formats above:
[layer_1_val, [layer_2_array_vals], {‘filename’:file_with_layer_3_data, ‘factor’:fct, ‘iprn’:print}]
-
load : (first_line : string, file_handle : file descriptor,
- block_header : MFBlockHeader, pre_data_comments : MFComment) : tuple (bool, string)
Loads data from first_line (the first line of data) and open file file_handle which is pointing to the second line of data. Returns a tuple with the first item indicating whether all data was read and the second item being the last line of text read from the file.
-
get_file_entry : (layer : int) : string
Returns a string containing the data in layer “layer”. For unlayered data do not pass in “layer”.
Notes
Examples
-
data
-
data_type
-
dtype
-
load
(first_line, file_handle, block_header, pre_data_comments=None, external_file_info=None)[source]¶
-
plot
(filename_base=None, file_extension=None, mflay=None, fignum=None, title=None, **kwargs)[source]¶ Plot 3-D model input data
Parameters: - 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)
- **kwargs (dict) –
- axes : list of matplotlib.pyplot.axis
- List of matplotlib.pyplot.axis that will be used to plot data for each layer. If axes=None axes will be generated. (default is None)
- pcolor : bool
- Boolean used to determine if matplotlib.pyplot.pcolormesh plot will be plotted. (default is True)
- colorbar : bool
- Boolean used to determine if a color bar will be added to the matplotlib.pyplot.pcolormesh. Only used if pcolor=True. (default is False)
- inactive : bool
- Boolean used to determine if a black overlay in inactive cells in a layer will be displayed. (default is True)
- contour : bool
- Boolean used to determine if matplotlib.pyplot.contour plot will be plotted. (default is False)
- clabel : bool
- Boolean used to determine if matplotlib.pyplot.clabel will be plotted. Only used if contour=True. (default is False)
- grid : bool
- Boolean used to determine if the model grid will be plotted on the figure. (default is False)
- masked_values : list
- List of unique values to be excluded from the plot.
Returns: out – Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis is returned.
Return type: list
-
plotable
-
class
MFTransientArray
(sim_data, model_or_sim, structure, enable=True, path=None, dimensions=None)[source]¶ Bases:
flopy.mf6.data.mfdataarray.MFArray
,flopy.mf6.data.mfdata.MFTransient
Provides an interface for the user to access and update MODFLOW transient array data.
Parameters: - sim_data (MFSimulationData) – data contained in the simulation
- structure (MFDataStructure) – describes the structure of the data
- data (list or ndarray) – actual data
- enable (bool) – enable/disable the array
- path (tuple) – path in the data dictionary to this MFArray
- dimensions (MFDataDimensions) – dimension information related to the model, package, and array
-
add_transient_key : (transient_key : int)
Adds a new transient time allowing data for that time to be stored and retrieved using the key “transient_key”
-
get_data : (layer_num : int, key : int) : ndarray
Returns the data associated with layer “layer_num” during time “key”. If “layer_num” is None, returns all data for time “key”.
-
set_data : (data : ndarray/list, multiplier : float, layer_num : int,
key : int) Sets the contents of the data at layer “layer_num” and time “key” to “data” with multiplier “multiplier”. For unlayered data do not pass in “layer_num”.
-
load : (first_line : string, file_handle : file descriptor,
- block_header : MFBlockHeader, pre_data_comments : MFComment) : tuple (bool, string)
Loads data from first_line (the first line of data) and open file handle which is pointing to the second line of data. Returns a tuple with the first item indicating whether all data was read and the second item being the last line of text read from the file.
-
get_file_entry : (layer : int, key : int) : string
Returns a string containing the data in layer “layer” at time “key”. For unlayered data do not pass in “layer”.
Notes
Examples
-
data_type
¶
-
load
(first_line, file_handle, block_header, pre_data_comments=None, external_file_info=None)[source]¶
-
plot
(kper=None, filename_base=None, file_extension=None, mflay=None, fignum=None, **kwargs)[source]¶ Plot transient array model input data
Parameters: - transient2d (flopy.utils.util_array.Transient2D object) –
- 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’)
- **kwargs (dict) –
- axes : list of matplotlib.pyplot.axis
- List of matplotlib.pyplot.axis that will be used to plot data for each layer. If axes=None axes will be generated. (default is None)
- pcolor : bool
- Boolean used to determine if matplotlib.pyplot.pcolormesh plot will be plotted. (default is True)
- colorbar : bool
- Boolean used to determine if a color bar will be added to the matplotlib.pyplot.pcolormesh. Only used if pcolor=True. (default is False)
- inactive : bool
- Boolean used to determine if a black overlay in inactive cells in a layer will be displayed. (default is True)
- contour : bool
- Boolean used to determine if matplotlib.pyplot.contour plot will be plotted. (default is False)
- clabel : bool
- Boolean used to determine if matplotlib.pyplot.clabel will be plotted. Only used if contour=True. (default is False)
- grid : bool
- Boolean used to determine if the model grid will be plotted on the figure. (default is False)
- masked_values : list
- List of unique values to be excluded from the plot.
- kper : str
- MODFLOW zero-based stress period number to return. If kper=’all’ then data for all stress period will be extracted. (default is zero).
Returns: axes – Empty list is returned if filename_base is not None. Otherwise a list of matplotlib.pyplot.axis is returned.
Return type: list