Build surface water network for MODFLOW’s SFR Package

Surface water network

Creates surface water network, which can be used to create MODFLOW’s SFR.

Python packages

Python 3.6+ is required.

Required

  • geopandas – process spatial data similar to pandas
  • pyproj>=2.2 – spatial projection support
  • rtree – spatial index support

Optional

  • flopy – read/write MODFLOW models
  • netCDF4 – used to read TopNet files

Testing

Run pytest -v or python3 -m pytest -v

For faster multi-core pytest -v -n 2 (with pytest-xdist)

Examples

import geopandas
import pandas as pd
import swn
import swn.file

Read from Shapefile:

shp_srs = 'tests/data/DN2_Coastal_strahler1z_stream_vf.shp'
lines = geopandas.read_file(shp_srs)
lines.set_index('nzsegment', inplace=True, verify_integrity=True)  # optional

Or, read from PostGIS:

from sqlalchemy import create_engine, engine

con_url = engine.url.URL(drivername='postgresql', database='scigen')
con = create_engine(con_url)
sql = 'SELECT * FROM wrc.rec2_riverlines_coastal'
lines

 

 

 

To finish reading, please visit source site