flopy.utils.mflistfile Module

This is a set of classes for reading budget information out of MODFLOW-style listing files. Cumulative and incremental budgets are returned as numpy recarrays, which can then be easily plotted.

class flopy.utils.mflistfile.ListBudget(file_name, budgetkey=None, timeunit='days')

MODFLOW family list file handling

Parameters:

file_name : str

the list file name

budgetkey : str

the text string identifying the budget table. (default is None)

timeunit : str

the time unit to return in the recarray. (default is ‘days’)

Notes

The ListBudget class should not be instantiated directly. Access is through derived classes: MfListBudget (MODFLOW), SwtListBudget (SEAWAT) and SwrListBudget (MODFLOW with the SWR process)

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incremental, cumulative = mf_list.get_budget()
>>> df_in, df_out = mf_list.get_dataframes(start_datetime="10-21-2015")
get_budget(names=None)

Get the recarrays with the incremental and cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarrays

Numpy recarrays with the water budget items in list file. The recarray also includes totim, time_step, and stress_period. A separate recarray is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> budget = mf_list.get_budget()
get_cumulative(names=None)

Get a recarray with the cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> cumulative = mf_list.get_cumulative()
get_data(kstpkper=None, idx=None, totim=None, incremental=False)

Get water budget data from the list file for the specified conditions.

Parameters:

idx : int

The zero-based record number. The first record is record 0. (default is None).

kstpkper : tuple of ints

A tuple containing the time step and stress period (kstp, kper). These are zero-based kstp and kper values. (default is None).

totim : float

The simulation time. (default is None).

incremental : bool

Boolean flag used to determine if incremental or cumulative water budget data for the specified conditions will be returned. If incremental=True, incremental water budget data will be returned. If incremental=False, cumulative water budget data will be returned. (default is False).

Returns:

data : numpy recarray

Array has size (number of budget items, 3). Recarray names are ‘index’, ‘value’, ‘name’.

Notes

if both kstpkper and totim are None, will return the last entry

Examples

>>> import matplotlib.pyplot as plt
>>> import flopy
>>> mf_list = flopy.utils.MfListBudget("my_model.list")
>>> data = mf_list.get_data(kstpkper=(0,0))
>>> plt.bar(data['index'], data['value'])
>>> plt.xticks(data['index'], data['name'], rotation=45, size=6)
>>> plt.show()
get_dataframes(start_datetime='1-1-1970')

Get pandas dataframes with the incremental and cumulative water budget items in the list file.

Parameters:

start_datetime : str

If start_datetime is passed as None, the rows are indexed on totim. Otherwise, a DatetimeIndex is set. (default is 1-1-1970).

Returns:

out : panda dataframes

Pandas dataframes with the incremental and cumulative water budget items in list file. A separate pandas dataframe is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incrementaldf, cumulativedf = mf_list.get_dataframes()
get_incremental(names=None)

Get a recarray with the incremental water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incremental = mf_list.get_incremental()
get_kstpkper()

Get a list of unique stress periods and time steps in the list file water budgets.

Returns:

out : list of (kstp, kper) tuples

List of unique kstp, kper combinations in list file. kstp and kper values are zero-based.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> kstpkper = mf_list.get_kstpkper()
get_record_names()

Get a list of water budget record names in the file.

Returns:

out : list of strings

List of unique text names in the binary file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> names = mf_list.get_record_names()
get_times()

Get a list of unique water budget times in the list file.

Returns:

out : list of floats

List contains unique water budget simulation times (totim) in list file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> times = mf_list.get_times()
isvalid()

Get a boolean indicating if budget data are available in the file.

Returns:

out : boolean

Boolean indicating if budget data are available in the file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> valid = mf_list.isvalid()
class flopy.utils.mflistfile.MfListBudget(file_name, budgetkey=None, timeunit='days')
get_budget(names=None)

Get the recarrays with the incremental and cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarrays

Numpy recarrays with the water budget items in list file. The recarray also includes totim, time_step, and stress_period. A separate recarray is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> budget = mf_list.get_budget()
get_cumulative(names=None)

Get a recarray with the cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> cumulative = mf_list.get_cumulative()
get_data(kstpkper=None, idx=None, totim=None, incremental=False)

Get water budget data from the list file for the specified conditions.

Parameters:

idx : int

The zero-based record number. The first record is record 0. (default is None).

kstpkper : tuple of ints

A tuple containing the time step and stress period (kstp, kper). These are zero-based kstp and kper values. (default is None).

totim : float

The simulation time. (default is None).

incremental : bool

Boolean flag used to determine if incremental or cumulative water budget data for the specified conditions will be returned. If incremental=True, incremental water budget data will be returned. If incremental=False, cumulative water budget data will be returned. (default is False).

Returns:

data : numpy recarray

Array has size (number of budget items, 3). Recarray names are ‘index’, ‘value’, ‘name’.

Notes

if both kstpkper and totim are None, will return the last entry

Examples

>>> import matplotlib.pyplot as plt
>>> import flopy
>>> mf_list = flopy.utils.MfListBudget("my_model.list")
>>> data = mf_list.get_data(kstpkper=(0,0))
>>> plt.bar(data['index'], data['value'])
>>> plt.xticks(data['index'], data['name'], rotation=45, size=6)
>>> plt.show()
get_dataframes(start_datetime='1-1-1970')

Get pandas dataframes with the incremental and cumulative water budget items in the list file.

Parameters:

start_datetime : str

If start_datetime is passed as None, the rows are indexed on totim. Otherwise, a DatetimeIndex is set. (default is 1-1-1970).

Returns:

out : panda dataframes

Pandas dataframes with the incremental and cumulative water budget items in list file. A separate pandas dataframe is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incrementaldf, cumulativedf = mf_list.get_dataframes()
get_incremental(names=None)

Get a recarray with the incremental water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incremental = mf_list.get_incremental()
get_kstpkper()

Get a list of unique stress periods and time steps in the list file water budgets.

Returns:

out : list of (kstp, kper) tuples

List of unique kstp, kper combinations in list file. kstp and kper values are zero-based.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> kstpkper = mf_list.get_kstpkper()
get_record_names()

Get a list of water budget record names in the file.

Returns:

out : list of strings

List of unique text names in the binary file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> names = mf_list.get_record_names()
get_times()

Get a list of unique water budget times in the list file.

Returns:

out : list of floats

List contains unique water budget simulation times (totim) in list file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> times = mf_list.get_times()
isvalid()

Get a boolean indicating if budget data are available in the file.

Returns:

out : boolean

Boolean indicating if budget data are available in the file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> valid = mf_list.isvalid()
class flopy.utils.mflistfile.MfusgListBudget(file_name, budgetkey=None, timeunit='days')
get_budget(names=None)

Get the recarrays with the incremental and cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarrays

Numpy recarrays with the water budget items in list file. The recarray also includes totim, time_step, and stress_period. A separate recarray is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> budget = mf_list.get_budget()
get_cumulative(names=None)

Get a recarray with the cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> cumulative = mf_list.get_cumulative()
get_data(kstpkper=None, idx=None, totim=None, incremental=False)

Get water budget data from the list file for the specified conditions.

Parameters:

idx : int

The zero-based record number. The first record is record 0. (default is None).

kstpkper : tuple of ints

A tuple containing the time step and stress period (kstp, kper). These are zero-based kstp and kper values. (default is None).

totim : float

The simulation time. (default is None).

incremental : bool

Boolean flag used to determine if incremental or cumulative water budget data for the specified conditions will be returned. If incremental=True, incremental water budget data will be returned. If incremental=False, cumulative water budget data will be returned. (default is False).

Returns:

data : numpy recarray

Array has size (number of budget items, 3). Recarray names are ‘index’, ‘value’, ‘name’.

Notes

if both kstpkper and totim are None, will return the last entry

Examples

>>> import matplotlib.pyplot as plt
>>> import flopy
>>> mf_list = flopy.utils.MfListBudget("my_model.list")
>>> data = mf_list.get_data(kstpkper=(0,0))
>>> plt.bar(data['index'], data['value'])
>>> plt.xticks(data['index'], data['name'], rotation=45, size=6)
>>> plt.show()
get_dataframes(start_datetime='1-1-1970')

Get pandas dataframes with the incremental and cumulative water budget items in the list file.

Parameters:

start_datetime : str

If start_datetime is passed as None, the rows are indexed on totim. Otherwise, a DatetimeIndex is set. (default is 1-1-1970).

Returns:

out : panda dataframes

Pandas dataframes with the incremental and cumulative water budget items in list file. A separate pandas dataframe is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incrementaldf, cumulativedf = mf_list.get_dataframes()
get_incremental(names=None)

Get a recarray with the incremental water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incremental = mf_list.get_incremental()
get_kstpkper()

Get a list of unique stress periods and time steps in the list file water budgets.

Returns:

out : list of (kstp, kper) tuples

List of unique kstp, kper combinations in list file. kstp and kper values are zero-based.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> kstpkper = mf_list.get_kstpkper()
get_record_names()

Get a list of water budget record names in the file.

Returns:

out : list of strings

List of unique text names in the binary file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> names = mf_list.get_record_names()
get_times()

Get a list of unique water budget times in the list file.

Returns:

out : list of floats

List contains unique water budget simulation times (totim) in list file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> times = mf_list.get_times()
isvalid()

Get a boolean indicating if budget data are available in the file.

Returns:

out : boolean

Boolean indicating if budget data are available in the file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> valid = mf_list.isvalid()
class flopy.utils.mflistfile.SwrListBudget(file_name, budgetkey=None, timeunit='days')
get_budget(names=None)

Get the recarrays with the incremental and cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarrays

Numpy recarrays with the water budget items in list file. The recarray also includes totim, time_step, and stress_period. A separate recarray is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> budget = mf_list.get_budget()
get_cumulative(names=None)

Get a recarray with the cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> cumulative = mf_list.get_cumulative()
get_data(kstpkper=None, idx=None, totim=None, incremental=False)

Get water budget data from the list file for the specified conditions.

Parameters:

idx : int

The zero-based record number. The first record is record 0. (default is None).

kstpkper : tuple of ints

A tuple containing the time step and stress period (kstp, kper). These are zero-based kstp and kper values. (default is None).

totim : float

The simulation time. (default is None).

incremental : bool

Boolean flag used to determine if incremental or cumulative water budget data for the specified conditions will be returned. If incremental=True, incremental water budget data will be returned. If incremental=False, cumulative water budget data will be returned. (default is False).

Returns:

data : numpy recarray

Array has size (number of budget items, 3). Recarray names are ‘index’, ‘value’, ‘name’.

Notes

if both kstpkper and totim are None, will return the last entry

Examples

>>> import matplotlib.pyplot as plt
>>> import flopy
>>> mf_list = flopy.utils.MfListBudget("my_model.list")
>>> data = mf_list.get_data(kstpkper=(0,0))
>>> plt.bar(data['index'], data['value'])
>>> plt.xticks(data['index'], data['name'], rotation=45, size=6)
>>> plt.show()
get_dataframes(start_datetime='1-1-1970')

Get pandas dataframes with the incremental and cumulative water budget items in the list file.

Parameters:

start_datetime : str

If start_datetime is passed as None, the rows are indexed on totim. Otherwise, a DatetimeIndex is set. (default is 1-1-1970).

Returns:

out : panda dataframes

Pandas dataframes with the incremental and cumulative water budget items in list file. A separate pandas dataframe is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incrementaldf, cumulativedf = mf_list.get_dataframes()
get_incremental(names=None)

Get a recarray with the incremental water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incremental = mf_list.get_incremental()
get_kstpkper()

Get a list of unique stress periods and time steps in the list file water budgets.

Returns:

out : list of (kstp, kper) tuples

List of unique kstp, kper combinations in list file. kstp and kper values are zero-based.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> kstpkper = mf_list.get_kstpkper()
get_record_names()

Get a list of water budget record names in the file.

Returns:

out : list of strings

List of unique text names in the binary file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> names = mf_list.get_record_names()
get_times()

Get a list of unique water budget times in the list file.

Returns:

out : list of floats

List contains unique water budget simulation times (totim) in list file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> times = mf_list.get_times()
isvalid()

Get a boolean indicating if budget data are available in the file.

Returns:

out : boolean

Boolean indicating if budget data are available in the file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> valid = mf_list.isvalid()
class flopy.utils.mflistfile.SwtListBudget(file_name, budgetkey=None, timeunit='days')
get_budget(names=None)

Get the recarrays with the incremental and cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarrays

Numpy recarrays with the water budget items in list file. The recarray also includes totim, time_step, and stress_period. A separate recarray is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> budget = mf_list.get_budget()
get_cumulative(names=None)

Get a recarray with the cumulative water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> cumulative = mf_list.get_cumulative()
get_data(kstpkper=None, idx=None, totim=None, incremental=False)

Get water budget data from the list file for the specified conditions.

Parameters:

idx : int

The zero-based record number. The first record is record 0. (default is None).

kstpkper : tuple of ints

A tuple containing the time step and stress period (kstp, kper). These are zero-based kstp and kper values. (default is None).

totim : float

The simulation time. (default is None).

incremental : bool

Boolean flag used to determine if incremental or cumulative water budget data for the specified conditions will be returned. If incremental=True, incremental water budget data will be returned. If incremental=False, cumulative water budget data will be returned. (default is False).

Returns:

data : numpy recarray

Array has size (number of budget items, 3). Recarray names are ‘index’, ‘value’, ‘name’.

Notes

if both kstpkper and totim are None, will return the last entry

Examples

>>> import matplotlib.pyplot as plt
>>> import flopy
>>> mf_list = flopy.utils.MfListBudget("my_model.list")
>>> data = mf_list.get_data(kstpkper=(0,0))
>>> plt.bar(data['index'], data['value'])
>>> plt.xticks(data['index'], data['name'], rotation=45, size=6)
>>> plt.show()
get_dataframes(start_datetime='1-1-1970')

Get pandas dataframes with the incremental and cumulative water budget items in the list file.

Parameters:

start_datetime : str

If start_datetime is passed as None, the rows are indexed on totim. Otherwise, a DatetimeIndex is set. (default is 1-1-1970).

Returns:

out : panda dataframes

Pandas dataframes with the incremental and cumulative water budget items in list file. A separate pandas dataframe is returned for the incremental and cumulative water budget entries.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incrementaldf, cumulativedf = mf_list.get_dataframes()
get_incremental(names=None)

Get a recarray with the incremental water budget items in the list file.

Parameters:

names : str or list of strings

Selection of column names to return. If names is not None then totim, time_step, stress_period, and selection(s) will be returned. (default is None).

Returns:

out : recarray

Numpy recarray with the water budget items in list file. The recarray also includes totim, time_step, and stress_period.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> incremental = mf_list.get_incremental()
get_kstpkper()

Get a list of unique stress periods and time steps in the list file water budgets.

Returns:

out : list of (kstp, kper) tuples

List of unique kstp, kper combinations in list file. kstp and kper values are zero-based.

Examples

>>> mf_list = MfListBudget("my_model.list")
>>> kstpkper = mf_list.get_kstpkper()
get_record_names()

Get a list of water budget record names in the file.

Returns:

out : list of strings

List of unique text names in the binary file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> names = mf_list.get_record_names()
get_times()

Get a list of unique water budget times in the list file.

Returns:

out : list of floats

List contains unique water budget simulation times (totim) in list file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> times = mf_list.get_times()
isvalid()

Get a boolean indicating if budget data are available in the file.

Returns:

out : boolean

Boolean indicating if budget data are available in the file.

Examples

>>> mf_list = MfListBudget('my_model.list')
>>> valid = mf_list.isvalid()