swn.modflow.SwnModflow.get_location_frame_reach_info#
- SwnModflow.get_location_frame_reach_info(loc_df, downstream_bias=0.0, geom_loc_df=None)#
Get reach information to location data frame, matched by segnum.
- Parameters:
- loc_dfpd.DataFrame or geopandas.GeoDataFrame
Location [geo] dataframe, created by
SurfaceWaterNetwork.locate_geoms()
.- downstream_biasfloat, default 0.0
A bias used for spatial location matching that increase the likelihood of finding downstream reaches of a segnum if positive, and upstream reaches if negative. Valid range is -1.0 to 1.0. Default 0.0 is no bias, matching to the closest reach.
- geom_loc_dfgeopandas.GeoDataFrame, optional
Optional original geometry used to create
loc_df
, which is only needed ifloc_df
is a DataFrame or geometries are non-Point, otherwise there may be some ambiguity matching the best stream reach.
- Returns:
- pandas.DataFrame
reachID (SwnModflow), rno or ifno (SwnMf6)
zero-based cell index: k, i, j,
one-based reach index: iseg, ireach
dist_to_reach
Examples
>>> import flopy >>> import geopandas >>> import pandas as pd >>> 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) >>> obs_gs = geopandas.GeoSeries.from_wkt([ ... "POINT (56 103)", ... "POINT (62 90)"]) >>> obs_gs.index += 10 >>> loc_df = n.locate_geoms(obs_gs) >>> r_df = nm.get_location_frame_reach_info(loc_df) >>> r_df ifno k i j iseg ireach dist_to_reach 10 3 0 1 1 1 3 1.664101 11 7 0 2 1 3 2 2.000000 >>> loc_reach_df = pd.concat([loc_df, r_df], axis=1)