flopy.utils.swroutputfile Module

class flopy.utils.swroutputfile.SwrBudget(filename, precision='double', verbose=False)

Read binary SWR budget output from MODFLOW SWR Process binary output files

Parameters:

filename : string

Name of the swr budget output file

precision : string

‘single’ or ‘double’. Default is ‘double’.

verbose : bool

Write information to the screen. Default is False.

Examples

>>> import flopy
>>> stageobj = flopy.utils.SwrStage('mymodel.swr.bud')
get_connectivity()

Get connectivity data from the file.

Returns:

data : numpy array

Array has size (nrecord, 3). None is returned if swrtype is not ‘flow’

get_data(idx=None, kswrkstpkper=None, totim=None)

Get data from the file for the specified conditions.

Parameters:

idx : int

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

kswrkstpkper : tuple of ints

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

totim : float

The simulation time. (default is None)

Returns:

data : numpy record array

Array has size (nitems).

Notes

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

get_kswrkstpkper()

Get a list of unique stress periods, time steps, and swr time steps in the file

Returns:

out : list of (kswr, kstp, kper) tuples

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

get_nrecords()

Get the number of records in the file

Returns:

out : tuple of int

A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’.

get_ntimes()

Get the number of times in the file

Returns:

out : int

The number of simulation times (totim) in binary file.

get_record_names()

Get a list of unique record names in the file

Returns:

out : list of strings

List of unique text names in the binary file.

get_times()

Get a list of unique times in the file

Returns:

out : list of floats

List contains unique simulation times (totim) in binary file.

get_ts(irec=0, iconn=0, klay=0, istr=0)

Get a time series from a swr binary file.

Parameters:

irec : int

is the zero-based reach (stage, qm, qaq) or reach group number (budget) to retrieve. (default is 0)

iconn : int

is the zero-based connection number for reach (irch) to retrieve qm data. iconn is only used if qm data is being read. (default is 0)

klay : int

is the zero-based layer number for reach (irch) to retrieve qaq data . klay is only used if qaq data is being read. (default is 0)

klay : int

is the zero-based structure number for reach (irch) to retrieve structure data . isrt is only used if structure data is being read. (default is 0)

Returns:

out : numpy recarray

Array has size (ntimes, nitems). The first column in the data array will contain time (totim). nitems is 2 for stage data, 15 for budget data, 3 for qm data, and 11 for qaq data.

Notes

The irec, iconn, and klay values must be zero-based.

class flopy.utils.swroutputfile.SwrExchange(filename, precision='double', verbose=False)

Read binary SWR surface-water groundwater exchange output from MODFLOW SWR Process binary output files

Parameters:

filename : string

Name of the swr surface-water groundwater exchange output file

precision : string

‘single’ or ‘double’. Default is ‘double’.

verbose : bool

Write information to the screen. Default is False.

Examples

>>> import flopy
>>> stageobj = flopy.utils.SwrStage('mymodel.swr.qaq')
get_connectivity()

Get connectivity data from the file.

Returns:

data : numpy array

Array has size (nrecord, 3). None is returned if swrtype is not ‘flow’

get_data(idx=None, kswrkstpkper=None, totim=None)

Get data from the file for the specified conditions.

Parameters:

idx : int

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

kswrkstpkper : tuple of ints

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

totim : float

The simulation time. (default is None)

Returns:

data : numpy record array

Array has size (nitems).

Notes

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

get_kswrkstpkper()

Get a list of unique stress periods, time steps, and swr time steps in the file

Returns:

out : list of (kswr, kstp, kper) tuples

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

get_nrecords()

Get the number of records in the file

Returns:

out : tuple of int

A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’.

get_ntimes()

Get the number of times in the file

Returns:

out : int

The number of simulation times (totim) in binary file.

get_record_names()

Get a list of unique record names in the file

Returns:

out : list of strings

List of unique text names in the binary file.

get_times()

Get a list of unique times in the file

Returns:

out : list of floats

List contains unique simulation times (totim) in binary file.

get_ts(irec=0, iconn=0, klay=0, istr=0)

Get a time series from a swr binary file.

Parameters:

irec : int

is the zero-based reach (stage, qm, qaq) or reach group number (budget) to retrieve. (default is 0)

iconn : int

is the zero-based connection number for reach (irch) to retrieve qm data. iconn is only used if qm data is being read. (default is 0)

klay : int

is the zero-based layer number for reach (irch) to retrieve qaq data . klay is only used if qaq data is being read. (default is 0)

klay : int

is the zero-based structure number for reach (irch) to retrieve structure data . isrt is only used if structure data is being read. (default is 0)

Returns:

out : numpy recarray

Array has size (ntimes, nitems). The first column in the data array will contain time (totim). nitems is 2 for stage data, 15 for budget data, 3 for qm data, and 11 for qaq data.

Notes

The irec, iconn, and klay values must be zero-based.

class flopy.utils.swroutputfile.SwrFile(filename, swrtype='stage', precision='double', verbose=False)

Read binary SWR output from MODFLOW SWR Process binary output files The SwrFile class is the super class from which specific derived classes are formed. This class should not be instantiated directly

Parameters:

filename : string

Name of the swr output file

swrtype : str

swr data type. Valid data types are ‘stage’, ‘budget’, ‘flow’, ‘exchange’, or ‘structure’. (default is ‘stage’)

precision : string

‘single’ or ‘double’. Default is ‘double’.

verbose : bool

Write information to the screen. Default is False.

Examples

>>> import flopy
>>> so = flopy.utils.SwrFile('mymodel.swr.stage.bin')
get_connectivity()

Get connectivity data from the file.

Returns:

data : numpy array

Array has size (nrecord, 3). None is returned if swrtype is not ‘flow’

get_data(idx=None, kswrkstpkper=None, totim=None)

Get data from the file for the specified conditions.

Parameters:

idx : int

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

kswrkstpkper : tuple of ints

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

totim : float

The simulation time. (default is None)

Returns:

data : numpy record array

Array has size (nitems).

Notes

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

get_kswrkstpkper()

Get a list of unique stress periods, time steps, and swr time steps in the file

Returns:

out : list of (kswr, kstp, kper) tuples

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

get_nrecords()

Get the number of records in the file

Returns:

out : tuple of int

A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’.

get_ntimes()

Get the number of times in the file

Returns:

out : int

The number of simulation times (totim) in binary file.

get_record_names()

Get a list of unique record names in the file

Returns:

out : list of strings

List of unique text names in the binary file.

get_times()

Get a list of unique times in the file

Returns:

out : list of floats

List contains unique simulation times (totim) in binary file.

get_ts(irec=0, iconn=0, klay=0, istr=0)

Get a time series from a swr binary file.

Parameters:

irec : int

is the zero-based reach (stage, qm, qaq) or reach group number (budget) to retrieve. (default is 0)

iconn : int

is the zero-based connection number for reach (irch) to retrieve qm data. iconn is only used if qm data is being read. (default is 0)

klay : int

is the zero-based layer number for reach (irch) to retrieve qaq data . klay is only used if qaq data is being read. (default is 0)

klay : int

is the zero-based structure number for reach (irch) to retrieve structure data . isrt is only used if structure data is being read. (default is 0)

Returns:

out : numpy recarray

Array has size (ntimes, nitems). The first column in the data array will contain time (totim). nitems is 2 for stage data, 15 for budget data, 3 for qm data, and 11 for qaq data.

Notes

The irec, iconn, and klay values must be zero-based.

class flopy.utils.swroutputfile.SwrFlow(filename, precision='double', verbose=False)

Read binary SWR flow output from MODFLOW SWR Process binary output files

Parameters:

filename : string

Name of the swr flow output file

precision : string

‘single’ or ‘double’. Default is ‘double’.

verbose : bool

Write information to the screen. Default is False.

Examples

>>> import flopy
>>> stageobj = flopy.utils.SwrStage('mymodel.swr.flow')
get_connectivity()

Get connectivity data from the file.

Returns:

data : numpy array

Array has size (nrecord, 3). None is returned if swrtype is not ‘flow’

get_data(idx=None, kswrkstpkper=None, totim=None)

Get data from the file for the specified conditions.

Parameters:

idx : int

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

kswrkstpkper : tuple of ints

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

totim : float

The simulation time. (default is None)

Returns:

data : numpy record array

Array has size (nitems).

Notes

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

get_kswrkstpkper()

Get a list of unique stress periods, time steps, and swr time steps in the file

Returns:

out : list of (kswr, kstp, kper) tuples

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

get_nrecords()

Get the number of records in the file

Returns:

out : tuple of int

A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’.

get_ntimes()

Get the number of times in the file

Returns:

out : int

The number of simulation times (totim) in binary file.

get_record_names()

Get a list of unique record names in the file

Returns:

out : list of strings

List of unique text names in the binary file.

get_times()

Get a list of unique times in the file

Returns:

out : list of floats

List contains unique simulation times (totim) in binary file.

get_ts(irec=0, iconn=0, klay=0, istr=0)

Get a time series from a swr binary file.

Parameters:

irec : int

is the zero-based reach (stage, qm, qaq) or reach group number (budget) to retrieve. (default is 0)

iconn : int

is the zero-based connection number for reach (irch) to retrieve qm data. iconn is only used if qm data is being read. (default is 0)

klay : int

is the zero-based layer number for reach (irch) to retrieve qaq data . klay is only used if qaq data is being read. (default is 0)

klay : int

is the zero-based structure number for reach (irch) to retrieve structure data . isrt is only used if structure data is being read. (default is 0)

Returns:

out : numpy recarray

Array has size (ntimes, nitems). The first column in the data array will contain time (totim). nitems is 2 for stage data, 15 for budget data, 3 for qm data, and 11 for qaq data.

Notes

The irec, iconn, and klay values must be zero-based.

class flopy.utils.swroutputfile.SwrStage(filename, precision='double', verbose=False)

Read binary SWR stage output from MODFLOW SWR Process binary output files

Parameters:

filename : string

Name of the swr stage output file

precision : string

‘single’ or ‘double’. Default is ‘double’.

verbose : bool

Write information to the screen. Default is False.

Examples

>>> import flopy
>>> stageobj = flopy.utils.SwrStage('mymodel.swr.stg')
get_connectivity()

Get connectivity data from the file.

Returns:

data : numpy array

Array has size (nrecord, 3). None is returned if swrtype is not ‘flow’

get_data(idx=None, kswrkstpkper=None, totim=None)

Get data from the file for the specified conditions.

Parameters:

idx : int

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

kswrkstpkper : tuple of ints

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

totim : float

The simulation time. (default is None)

Returns:

data : numpy record array

Array has size (nitems).

Notes

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

get_kswrkstpkper()

Get a list of unique stress periods, time steps, and swr time steps in the file

Returns:

out : list of (kswr, kstp, kper) tuples

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

get_nrecords()

Get the number of records in the file

Returns:

out : tuple of int

A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’.

get_ntimes()

Get the number of times in the file

Returns:

out : int

The number of simulation times (totim) in binary file.

get_record_names()

Get a list of unique record names in the file

Returns:

out : list of strings

List of unique text names in the binary file.

get_times()

Get a list of unique times in the file

Returns:

out : list of floats

List contains unique simulation times (totim) in binary file.

get_ts(irec=0, iconn=0, klay=0, istr=0)

Get a time series from a swr binary file.

Parameters:

irec : int

is the zero-based reach (stage, qm, qaq) or reach group number (budget) to retrieve. (default is 0)

iconn : int

is the zero-based connection number for reach (irch) to retrieve qm data. iconn is only used if qm data is being read. (default is 0)

klay : int

is the zero-based layer number for reach (irch) to retrieve qaq data . klay is only used if qaq data is being read. (default is 0)

klay : int

is the zero-based structure number for reach (irch) to retrieve structure data . isrt is only used if structure data is being read. (default is 0)

Returns:

out : numpy recarray

Array has size (ntimes, nitems). The first column in the data array will contain time (totim). nitems is 2 for stage data, 15 for budget data, 3 for qm data, and 11 for qaq data.

Notes

The irec, iconn, and klay values must be zero-based.

class flopy.utils.swroutputfile.SwrStructure(filename, precision='double', verbose=False)

Read binary SWR structure output from MODFLOW SWR Process binary output files

Parameters:

filename : string

Name of the swr structure output file

precision : string

‘single’ or ‘double’. Default is ‘double’.

verbose : bool

Write information to the screen. Default is False.

Examples

>>> import flopy
>>> stageobj = flopy.utils.SwrStage('mymodel.swr.str')
get_connectivity()

Get connectivity data from the file.

Returns:

data : numpy array

Array has size (nrecord, 3). None is returned if swrtype is not ‘flow’

get_data(idx=None, kswrkstpkper=None, totim=None)

Get data from the file for the specified conditions.

Parameters:

idx : int

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

kswrkstpkper : tuple of ints

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

totim : float

The simulation time. (default is None)

Returns:

data : numpy record array

Array has size (nitems).

Notes

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

get_kswrkstpkper()

Get a list of unique stress periods, time steps, and swr time steps in the file

Returns:

out : list of (kswr, kstp, kper) tuples

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

get_nrecords()

Get the number of records in the file

Returns:

out : tuple of int

A tupe with the number of records and number of flow items in the file. The number of flow items is non-zero only if swrtype=’flow’.

get_ntimes()

Get the number of times in the file

Returns:

out : int

The number of simulation times (totim) in binary file.

get_record_names()

Get a list of unique record names in the file

Returns:

out : list of strings

List of unique text names in the binary file.

get_times()

Get a list of unique times in the file

Returns:

out : list of floats

List contains unique simulation times (totim) in binary file.

get_ts(irec=0, iconn=0, klay=0, istr=0)

Get a time series from a swr binary file.

Parameters:

irec : int

is the zero-based reach (stage, qm, qaq) or reach group number (budget) to retrieve. (default is 0)

iconn : int

is the zero-based connection number for reach (irch) to retrieve qm data. iconn is only used if qm data is being read. (default is 0)

klay : int

is the zero-based layer number for reach (irch) to retrieve qaq data . klay is only used if qaq data is being read. (default is 0)

klay : int

is the zero-based structure number for reach (irch) to retrieve structure data . isrt is only used if structure data is being read. (default is 0)

Returns:

out : numpy recarray

Array has size (ntimes, nitems). The first column in the data array will contain time (totim). nitems is 2 for stage data, 15 for budget data, 3 for qm data, and 11 for qaq data.

Notes

The irec, iconn, and klay values must be zero-based.