flopy.mf6.data.mfdatalist module¶
-
class
MFList
(sim_data, model_or_sim, structure, data=None, enable=True, path=None, dimensions=None, package=None)[source]¶ Bases:
flopy.mf6.data.mfdata.MFMultiDimVar
,flopy.datbase.DataListInterface
Provides an interface for the user to access and update MODFLOW scalar 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
-
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/dict, 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:
- ndarray - ndarray containing the datalist
- [(line_one), (line_two), …] - list where each like of the datalist is a tuple within the list
- {‘filename’:filename, factor=fct, iprn=print_code, data=data} - dictionary defining the external file containing the datalist.
If the data is transient, a dictionary can be used to specify each stress period where the dictionary key is <stress period> - 1 and the dictionary value is the datalist data defined above: {0:ndarray, 1:[(line_one), (line_two), …], 2:{‘filename’:filename})
-
append_data : (data : list(tuple))
Appends “data” to the end of this list. Assumes data is in a format that can be appended directly to a numpy recarray.
-
append_list_as_record : (data : list)
Appends the list “data” as a single record in this list’s recarray. Assumes “data” has the correct dimensions.
-
update_record : (record : list, key_index : int)
Updates a record at index “key_index” with the contents of “record”. If the index does not exist update_record appends the contents of “record” to this list’s recarray.
-
search_data : (search_term : string, col : int)
Searches the list data at column “col” for “search_term”. If col is None search_data searches the entire list.
-
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”.
-
store_as_external_file : (external_file_path : str, binary : bool)
store all data externally in file external_file_path. the binary allows storage in a binary file. If replace_existing_external is set to False, this method will not do anything if the data is already in an external file.
Notes
Examples
-
data_type
-
dtype
-
load
(first_line, file_handle, block_header, pre_data_comments=None, external_file_info=None)[source]¶
-
package
¶
-
plot
(key=None, names=None, filename_base=None, file_extension=None, mflay=None, **kwargs)[source]¶ Plot boundary condition (MfList) data
Parameters: - key (str) – MfList dictionary key. (default is None)
- names (list) – List of names for figure titles. (default is None)
- 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
MFMultipleList
(sim_data, model_or_sim, structure, enable=True, path=None, dimensions=None, package=None)[source]¶ Bases:
flopy.mf6.data.mfdatalist.MFTransientList
Provides an interface for the user to access and update MODFLOW multiple list data. This is list data that is in the same format as the MFTransientList, but is not time based.
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
Notes
Examples
-
class
MFTransientList
(sim_data, model_or_sim, structure, enable=True, path=None, dimensions=None, package=None)[source]¶ Bases:
flopy.mf6.data.mfdatalist.MFList
,flopy.mf6.data.mfdata.MFTransient
,flopy.datbase.DataListInterface
Provides an interface for the user to access and update MODFLOW transient list 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”
-
add_one :(transient_key : int)
Adds one to the data stored at key “transient_key”
-
get_data : (key : int) : ndarray
Returns the data during time “key”.
-
set_data : (data : ndarray/list, multiplier : float, key : int)
Sets the contents of the data at time “key” to “data” with multiplier “multiplier”.
-
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 : (key : int) : string
Returns a string containing the data at time “key”.
-
append_list_as_record : (data : list, key : int)
Appends the list “data” as a single record in this list’s recarray at time “key”. Assumes “data” has the correct dimensions.
-
update_record : (record : list, key_index : int, key : int)
Updates a record at index “key_index” and time “key” with the contents of “record”. If the index does not exist update_record appends the contents of “record” to this list’s recarray.
Notes
Examples
-
data
¶
-
data_type
¶
-
dtype
¶
-
load
(first_line, file_handle, block_header, pre_data_comments=None, external_file_info=None)[source]¶
-
masked_4D_arrays
¶
-
plot
(key=None, names=None, kper=0, filename_base=None, file_extension=None, mflay=None, **kwargs)[source]¶ Plot stress period boundary condition (MfList) data for a specified stress period
Parameters: - key (str) – MfList dictionary key. (default is None)
- names (list) – List of names for figure titles. (default is None)
- kper (int) – MODFLOW zero-based stress period number to return. (default is zero)
- 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