swn.modflow.SwnMf6.gather_reaches#

SwnMf6.gather_reaches(*, upstream=[], downstream=[], barrier=[], gather_upstream=False)#

Return reaches upstream (inclusive) and downstream (exclusive).

Parameters:
upstream, downstreamint or list, default []

Reach number(s) (rno or ifno) from reaches.index to search from.

barriersint or list, default []

Reach number(s) that cannot be traversed past.

gather_upstreambool, default False

Gather upstream from all other downstream reaches.

Returns:
list

See also

route_reaches

Return a list of reaches that connect a pair of reaches.

Examples

>>> import flopy
>>> import geopandas
>>> import swn
>>> lines = geopandas.GeoSeries.from_wkt([
...    "LINESTRING (60 100, 60  80)",
...    "LINESTRING (40 130, 60 100)",
...    "LINESTRING (70 130, 60 100)"])
>>> lines.index += 100
>>> n = swn.SurfaceWaterNetwork.from_lines(lines)
>>> sim = flopy.mf6.MFSimulation()
>>> _ = flopy.mf6.ModflowTdis(sim, nper=1, time_units="days")
>>> gwf = flopy.mf6.ModflowGwf(sim)
>>> _ = flopy.mf6.ModflowGwfdis(
...     gwf, nrow=3, ncol=2, delr=20.0, delc=20.0, idomain=1,
...     length_units="meters", xorigin=30.0, yorigin=70.0)
>>> nm = swn.SwnMf6.from_swn_flopy(n, gwf)
>>> nm.reaches[["iseg", "ireach", "to_ifno", "from_ifnos", "segnum"]]
     iseg  ireach  to_ifno from_ifnos  segnum
ifno
1       1       1        2         {}     101
2       1       2        3        {1}     101
3       1       3        6        {2}     101
4       2       1        5         {}     102
5       2       2        6        {4}     102
6       3       1        7     {3, 5}     100
7       3       2        0        {6}     100
>>> nm.gather_reaches(upstream=6)
[6, 3, 2, 1, 5, 4]
>>> nm.gather_reaches(downstream=4)
[5, 6, 7]