SouthForkResearch / pyGNAT

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

Calculate (Strahler) stream order #8

Open jesselangdon opened 7 years ago

jesselangdon commented 7 years ago

Calculate Strahler stream order for a network (i.e. headwaters = 1)

Required for:

Refer to Arcpy GNAT Calculate Stream Order tool.

MattReimer commented 7 years ago

Is this as easy as finding the headwaters and assigning everything downstream an order?

KellyMWhitehead commented 7 years ago

Generally, yes. The arcpy script is slow due to creating and selecting multiple layers per iteration (actually, this is quite fast at the start/headwaters, but slow when it works down the network). Things like multi-threaded channels (cycles) or disconnections need to be overcome as well.

MattReimer commented 7 years ago

I think we can get there quickly by:

  1. Finding the headwater (which we can do now)
  2. reversing the networkx network (so we can traverse it backwards)
  3. doing a depth-first-search and incrementing orders based on traversal depths.