swn.modflow.SwnModflow.set_segment_data_from_scalar#

SwnModflow.set_segment_data_from_scalar(name: str, data, which: str = 'all')#

Set segment data from a scalar.

This method can be used to set segment_data, which does not vary in time. It does not modify segment_data_ts.

Parameters:
namestr

Name for dataset, from segment_data columns.

dataint or float

Data to assign to each segment. If a float, this value is a constant. If a pandas Series, then this is applied for each segment.

whichstr, default = “all”

Determine which segment_data rows should be set as “segments”, “diversions” (determined from IUPSEG), or “all”.

See also

set_segment_data_from_segments

Set all segment data from segments.

set_segment_data_from_diversions

Set all segment data from diversions.

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)
>>> 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_scalar("icalc", 1)
>>> print(nm.segment_data[["segnum", "icalc"]])
      segnum  icalc
nseg
1        101      1
2        102      1
3        100      1