SouthForkResearch / pyGNAT

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

Find true braids #11

Closed jesselangdon closed 7 years ago

jesselangdon commented 7 years ago

We need to be able to automatically label stream features as "true" braids, vs stream features that form a polygon (for instance, when canals cross a two or more stream channels.)

MattReimer commented 7 years ago

I think we might be able to do this with NetowrkX and cycles:

from wikipedia:

In graph theory, a cycle graph or circular graph is a graph that consists of a single cycle, or in other words, some number of vertices connected in a closed chain. The cycle graph with n vertices is called Cn.

The way I would approach this problem:

  1. Parse the SHP file into a simplified networkX object
  2. Find all the cycles
  3. Loop over each cycle and determine the "trueness" of the braid.
  4. Output the results (possibly to a shapefile using shapely)
MattReimer commented 7 years ago

Check out the commit above. It demonstrates (I think) how we can identift braids:

The output is:

screen shot 2017-03-10 at 12 10 23 pm

jesselangdon commented 7 years ago

We also be need to be able to filter out stream segments by attributes.

Check out: https://github.com/SouthForkResearch/pyGNAT/commit/bd6bb3cc792e3086427820e37a69008635f84af3

(Not sure why the original G is printing out with the weird blocky symbols.)

jesselangdon commented 7 years ago

This has been incorporated into network.py