swn.modflow.SwnModflow#

class swn.modflow.SwnModflow(logger=None)#

Surface water network adaptor for MODFLOW.

Attributes:
swnswn.SurfaceWaterNetwork

Surface water network object.

modelflopy.modflow.Modflow

Flopy model object.

segmentsgeopandas.GeoDataFrame

Geo dataframe of segments.

segment_datapd.DataFrame or None

Dataframe of segment data.

segment_data_tsdict or None

Dict of dataframes of time-varying segment data.

reachesgeopandas.GeoDataFrame

Geo dataframe of model cell-by-cell reaches.

diversionsgeopandas.GeoDataFrame, pandas.DataFrame or None

[Geo] dataframe of diversions.

loggerlogging.Logger

Logger to show messages.

Methods

add_model_topbot_to_reaches()

Get top and bottom elevation of the model cell containing each reach.

default_segment_data([hyd_cond1, ...])

High-level function to set default segment_data for MODFLOW SFR.

fix_reach_elevs([minslope, fix_dis, minthick])

Fix reach elevations.

fix_segment_elevs([min_incise, min_slope, ...])

Provide wrapper function for calculating SFR segment elevations.

flopy_package_period(package[, auxiliary])

Return dict of lists of lists for flopy's stress_period_data.

flopy_reach_data()

Return numpy.recarray for flopy's ModflowSfr2 reach_data.

flopy_segment_data()

Return dict of numpy.recarray for flopy's ModflowSfr2 segment_data.

from_pickle(path[, swn, model])

Read a pickled format from a file.

from_swn_flopy(swn, model[, ibound_action, ...])

Create a MODFLOW SFR structure from a surface water network.

get_location_frame_reach_info(loc_df[, ...])

Get reach information to location data frame, matched by segnum.

get_outseg_elev()

Get the max elevup from all downstream segments for each segment.

get_seg_ijk()

Get the k,i,j location of upstream and downstream segments for each segment

get_segment_incision()

Calculate the upstream and downstream incision of the segment.

get_segment_length()

Get segment length from accumulated reach lengths.

get_top_elevs_at_segs()

Get topsurface elevations associated with segment up and dn elevations.

minslope_seg(seg, *args)

Force segment to have minimum slope (check for backward flowing segs).

new_segment_data()

Generate empty segment data.

package_period_frame(package, style[, auxiliary])

Return DataFrame of stress period data for MODFLOW packages.

plot([column, cmap, colorbar, ax])

Show map of reaches with inflow segments in royalblue.

plot_profile(segnum[, upstream, downstream, ax])

Plot stream top profiles vs model grid top and bottom.

plot_reaches_above([model, seg, dem, ...])

Plot map of stream elevations relative to model surfaces.

plot_reaches_vs_model(seg[, dem, ...])

Plot map of stream elevations relative to model surfaces.

reconcile_reach_strtop()

Recalculate reach strtop elevations after moving segment elevations.

route_reaches(start, end, *[, allow_indirect])

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

set_forward_segs([min_slope])

Set minimum slope in forwards direction.

set_outseg_elev_for_seg(seg)

Set outseg elevation for segment.

set_package_obj(package[, auxiliary])

Set MODFLOW package data to flopy model.

set_reach_data_from_array(name, array)

Set reach data from an array that matches the model (nrow, ncol).

set_reach_data_from_segments(name, value[, ...])

Set reach data based on segment series (or scalar).

set_reach_slope([method, min_slope])

Set slope for reaches.

set_seg_minincise([minincise, max_str_z])

Set segment elevation to have the minimum incision from the top.

set_segment_data_from_diversions(name, data)

Set segment data from a series indexed by diversions.

set_segment_data_from_scalar(name, data[, which])

Set segment data from a scalar.

set_segment_data_from_segments(name, data)

Set segment data from a series indexed by segments.

set_segment_data_inflow(data)

Set segment_data inflow data upstream of the model.

set_sfr_obj(**kwds)

Set MODFLOW SFR package data to flopy model.

set_topbot_elevs_at_reaches()

Legacy method to add model top and bottom information to reaches.

to_pickle(path[, protocol])

Pickle (serialize) non-flopy object data to file.

write_package_period(package, fname[, auxiliary])

Write PERIOD file for MODFLOW packages, to be used within OPEN/CLOSE.

__init__(logger=None)#

Initialise SwnModflow.

Parameters:
loggerlogging.Logger, optional

Logger to show messages.

Methods

__init__([logger])

Initialise SwnModflow.

add_model_topbot_to_reaches()

Get top and bottom elevation of the model cell containing each reach.

default_segment_data([hyd_cond1, ...])

High-level function to set default segment_data for MODFLOW SFR.

fix_reach_elevs([minslope, fix_dis, minthick])

Fix reach elevations.

fix_segment_elevs([min_incise, min_slope, ...])

Provide wrapper function for calculating SFR segment elevations.

flopy_package_period(package[, auxiliary])

Return dict of lists of lists for flopy's stress_period_data.

flopy_reach_data()

Return numpy.recarray for flopy's ModflowSfr2 reach_data.

flopy_segment_data()

Return dict of numpy.recarray for flopy's ModflowSfr2 segment_data.

from_pickle(path[, swn, model])

Read a pickled format from a file.

from_swn_flopy(swn, model[, ibound_action, ...])

Create a MODFLOW SFR structure from a surface water network.

get_location_frame_reach_info(loc_df[, ...])

Get reach information to location data frame, matched by segnum.

get_outseg_elev()

Get the max elevup from all downstream segments for each segment.

get_seg_ijk()

Get the k,i,j location of upstream and downstream segments for each segment

get_segment_incision()

Calculate the upstream and downstream incision of the segment.

get_segment_length()

Get segment length from accumulated reach lengths.

get_top_elevs_at_segs()

Get topsurface elevations associated with segment up and dn elevations.

minslope_seg(seg, *args)

Force segment to have minimum slope (check for backward flowing segs).

new_segment_data()

Generate empty segment data.

package_period_frame(package, style[, auxiliary])

Return DataFrame of stress period data for MODFLOW packages.

plot([column, cmap, colorbar, ax])

Show map of reaches with inflow segments in royalblue.

plot_profile(segnum[, upstream, downstream, ax])

Plot stream top profiles vs model grid top and bottom.

plot_reaches_above([model, seg, dem, ...])

Plot map of stream elevations relative to model surfaces.

plot_reaches_vs_model(seg[, dem, ...])

Plot map of stream elevations relative to model surfaces.

reconcile_reach_strtop()

Recalculate reach strtop elevations after moving segment elevations.

route_reaches(start, end, *[, allow_indirect])

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

set_forward_segs([min_slope])

Set minimum slope in forwards direction.

set_outseg_elev_for_seg(seg)

Set outseg elevation for segment.

set_package_obj(package[, auxiliary])

Set MODFLOW package data to flopy model.

set_reach_data_from_array(name, array)

Set reach data from an array that matches the model (nrow, ncol).

set_reach_data_from_segments(name, value[, ...])

Set reach data based on segment series (or scalar).

set_reach_slope([method, min_slope])

Set slope for reaches.

set_seg_minincise([minincise, max_str_z])

Set segment elevation to have the minimum incision from the top.

set_segment_data_from_diversions(name, data)

Set segment data from a series indexed by diversions.

set_segment_data_from_scalar(name, data[, which])

Set segment data from a scalar.

set_segment_data_from_segments(name, data)

Set segment data from a series indexed by segments.

set_segment_data_inflow(data)

Set segment_data inflow data upstream of the model.

set_sfr_obj(**kwds)

Set MODFLOW SFR package data to flopy model.

set_topbot_elevs_at_reaches()

Legacy method to add model top and bottom information to reaches.

to_pickle(path[, protocol])

Pickle (serialize) non-flopy object data to file.

write_package_period(package, fname[, auxiliary])

Write PERIOD file for MODFLOW packages, to be used within OPEN/CLOSE.

Attributes

diversions

[Geo] dataframe of diversions.

model

Flopy model object.

reaches

Geo dataframe of model cell-by-cell reaches.

segment_data

Dataframe of segment data.

segment_data_ts

Dict of dataframes of time-varying segment data.

segments

Geo dataframe of segments.

swn

Surface water network object.