swn.modflow.SwnModflow.set_segment_data_from_diversions#
- SwnModflow.set_segment_data_from_diversions(name: str, data)#
Set segment data from a series indexed by diversions.
Modifies
segment_data
orsegment_data_ts
.- Parameters:
- namestr
Name for dataset, from
segment_data
columns.- datafloat, dict, pandas.Series or pandas.DataFrame
Data to assigned from diversions. If a pandas Series, then this is applied for each index matched by divid. If a dict, then each item is applied for each key matched by divid.
See also
set_segment_data_from_scalar
Set all segment data to one value.
set_segment_data_from_segments
Set all segment data from segments.
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) >>> diversions = geopandas.GeoSeries.from_wkt([ ... "POINT (58 100)", ... "POINT (58 100)"]).to_frame("geometry") >>> diversions.index += 10 >>> diversions["rate"] = [1.1, 2.2] >>> n.set_diversions(diversions=diversions) >>> m = flopy.modflow.Modflow(version="mf2005") >>> _ = flopy.modflow.ModflowDis( ... m, nrow=3, ncol=2, delr=20.0, delc=20.0, xul=30.0, yul=130.0, ... top=15.0, botm=10.0) >>> _ = flopy.modflow.ModflowBas(m) >>> nm = swn.modflow.SwnModflow.from_swn_flopy(n, m) >>> nm.set_segment_data_from_diversions("abstraction", diversions.rate) >>> print(nm.segment_data[["divid", "iupseg", "abstraction"]]) divid iupseg abstraction nseg 1 0 0 0.0 2 0 0 0.0 3 0 0 0.0 4 10 1 1.1 5 11 1 2.2