SouthForkResearch / pyGNAT

Geomorphic Network and Analysis Toolbox, redesigned using FOSS python libraries.
MIT License
2 stars 0 forks source link

Identify all reaches upstream from a point #7

Open jesselangdon opened 7 years ago

jesselangdon commented 7 years ago

Find all stream reaches that drain to a user-selected point or stream reach.

MattReimer commented 7 years ago

Here's where we could investigate using a directed graph (which btw is what shape files get imported as by default)

https://en.wikipedia.org/wiki/Directed_graph

Here's how I see it going down:

  1. Load the shp file using networkx. You should now have a directed network with all the segments having no direction set.
  2. traverse the network and set the directions.
  3. Use the "ancestry" algorithms that networkx gives you to figure out what's upstream and what's downstream of where you are
  4. Write the results.