1

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:

Length

69.98 <-- top of stream

90.228

94.206

85.429

94.039

99.095

92.983

76.736

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.

Thanks!

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 6, 2014 at 21:23
12
  • so each row in your stream attribute table corresponds to a segment? Commented Feb 6, 2014 at 22:49
  • Yeah, each row is a segment length Commented Feb 6, 2014 at 22:51
  • does this table indicate the next downstream segment, too? Or is the routing topology stored elsewhere? If you have more to add, might just edit the original post. Commented Feb 6, 2014 at 22:52
  • It does not, other than the last value is the furthest point down slope and the first is the hightest point upstream Commented Feb 6, 2014 at 22:57
  • Your formula does not appear to compute a stream length index: this calculation depends on elevation differences as well as lengths, at least according to one of Hack's original papers (ees.lehigh.edu/ftp/retreat/outgoing/roma_tre_short_course/…). Is it possible that your stream has been broken into segments of equal elevation drop? Even then the last factor in the formula is mysterious; it does not seem to have any equivalent in the paper. Commented Feb 6, 2014 at 23:13

1 Answer 1

1

looking at the formula again, I'm realizing that there is no need for accumulation of lengths up/downstream. Makes things much simpler.

You can use Statistics to sum the length for the table/the stream in question. You can then use something like the following to capture that value

csr = arcpy.SearchCursor('TableViewOfStatsOutput)
row = csr.next()
sumLength= row.getValue("SUM_Length")

Then you should be able to write your formula into an CalculateField statement and get your answer.

answered Feb 6, 2014 at 23:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.