swn.modflow.SwnMf6.route_reaches#

SwnMf6.route_reaches(start, end, *, allow_indirect=False)#

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

Parameters:
start, endany

Start and end reach numbers (rno or ifno).

allow_indirectbool, default False

If True, allow the route to go downstream from start to a confluence, then route upstream to end. Default False allows only a direct route along a single direction up or down.

Returns:
list
Raises:
IndexError

If start and/or end reach numbers are not valid.

ConnecionError

If start and end reach numbers do not connect.

See also

gather_reaches

Query multiple reaches up and downstream.

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.route_reaches(1, 7)
[1, 2, 3, 6, 7]
>>> nm.reaches.loc[nm.route_reaches(1, 7), ["i", "j", "rlen"]]
     i  j       rlen
ifno
1    0  0  18.027756
2    0  1   6.009252
3    1  1  12.018504
6    1  1  10.000000
7    2  1  10.000000