flopy.mf6.data.mfdatascalar module

class MFScalar(sim_data, model_or_sim, structure, data=None, enable=True, path=None, dimensions=None)[source]

Bases: flopy.mf6.data.mfdata.MFData

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
data_type

type of data stored in the scalar

Type:DataType
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
has_data : () : bool

Returns whether this object has data associated with it.

get_data : () : ndarray

Returns the data associated with this object.

set_data : (data : ndarray/list, multiplier : float)

Sets the contents of the data 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 : () : string

Returns a string containing the data.

Notes

Examples

add_one()[source]
data
data_type
dtype
get_data(apply_mult=False, **kwargs)[source]
get_file_entry(values_only=False, one_based=False, ext_file_action=<ExtFileAction.copy_relative_paths: 3>)[source]
has_data()[source]
load(first_line, file_handle, block_header, pre_data_comments=None, external_file_info=None)[source]
plot(filename_base=None, file_extension=None, **kwargs)[source]

Helper method to plot scalar objects

Parameters:
  • scalar – flopy.mf6.data.mfscalar 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’)
Returns:

list matplotlib.axes object

Return type:

axes

plotable
set_data(data)[source]
class MFScalarTransient(sim_data, model_or_sim, structure, enable=True, path=None, dimensions=None)[source]

Bases: flopy.mf6.data.mfdatascalar.MFScalar, flopy.mf6.data.mfdata.MFTransient

Provides an interface for the user to access and update MODFLOW transient 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
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 associated with “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”.

Notes

Examples

add_one(key=0)[source]
add_transient_key(key)[source]
data_type
get_data(key=0, **kwargs)[source]
get_file_entry(key=None, ext_file_action=<ExtFileAction.copy_relative_paths: 3>)[source]
has_data(key=None)[source]
load(first_line, file_handle, block_header, pre_data_comments=None, external_file_info=None)[source]
plot(filename_base=None, file_extension=None, kper=0, fignum=None, **kwargs)[source]

Plot transient scalar model data

Parameters:
  • transientscalar (flopy.mf6.data.mfdatascalar.MFScalarTransient 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

plotable
set_data(data, key=None)[source]