flopy.utils.sfroutputfile module

class SfrFile(filename, geometries=None, verbose=False)[source]

Bases: object

Read SFR package results from text file (ISTCB2 > 0)

Parameters:
  • filename (str) – Name of the sfr output file

  • geometries (any) – Ignored

  • verbose (any) – Ignored

Notes

Indexing starts at one for: layer, row, column, segment, reach. Indexing starts at zero for: i, j, k, and kstpkper.

Examples

>>> import flopy
>>> sfq = flopy.utils.SfrFile('mymodel.sfq')
property df
dtypes = {'column': <class 'int'>, 'layer': <class 'int'>, 'reach': <class 'int'>, 'row': <class 'int'>, 'segment': <class 'int'>}
get_dataframe()[source]

Read the whole text file into a pandas dataframe.

Returns:

df – SFR output as a pandas dataframe

Return type:

pandas dataframe

static get_nstrm(df)[source]

Get the number of SFR cells from the results dataframe.

Returns:

nrch – Number of SFR cells

Return type:

int

get_results(segment, reach)[source]

Get results for a single reach or sequence of segments and reaches.

Parameters:
  • segment (int or sequence of ints) – Segment number for each location.

  • reach (int or sequence of ints) – Reach number for each location

Returns:

results – Dataframe of same format as SfrFile.df, but subset to input locations.

Return type:

dataframe

get_times()[source]

Parse the stress period/timestep headers.

Returns:

kstpkper – list of kstp, kper tuples

Return type:

tuple