I'm trying to calculate the Stream Length-Gradient Index of a stream (example data below). Just started to get into python, but am struggling with a solution to this problem. I have 42 streams to run this code on and doing it by with excel is tedious. The stream is broken up into segments and I'd like to get a SL index for each stream.
The equation: SL = (10/Length of segment)*(sum(length of segments) * (length of segment/2))
In each stream attribute table I have:
69.98 <-- top of stream
56.657 <----head of stream
Now the biggest hickup I have is that all the data is backwards I need to run the calculation from the head of the stream (bottom of the attribute table) to the top of the stream.