swn.modflow.SwnModflow#
- class swn.modflow.SwnModflow(logger=None)#
Surface water network adaptor for MODFLOW.
- Attributes:
swn
swn.SurfaceWaterNetworkSurface water network object.
model
flopy.modflow.ModflowFlopy model object.
segments
geopandas.GeoDataFrameGeo dataframe of segments.
segment_data
pd.DataFrame or NoneDataframe of segment data.
segment_data_ts
dict or NoneDict of dataframes of time-varying segment data.
reaches
geopandas.GeoDataFrameGeo dataframe of model cell-by-cell reaches.
diversions
geopandas.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).
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).
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
[Geo] dataframe of diversions.
Flopy model object.
Geo dataframe of model cell-by-cell reaches.
Dataframe of segment data.
Dict of dataframes of time-varying segment data.
Geo dataframe of segments.
swn
Surface water network object.