I would like to create a river system with water flow based on the following attribute table:

enter image description here

The river system is divided in different segments (the ID to every Segment is called "SegmentNo"). The column "Downstream" shows the ID from the next downstream segment. Not every segment have a water flow value. Only these segments with a waste water treatment plant (WWTP) in his environment. Now I would like to compute the water flow for each segment in downstream direction with the field calculator. Unfortunately I am not a hero in Python, so I can't create new functions. Probably it isn't necessary too. I have found a "When Then" solution which add up the water flow. But not in combination with the downstream segments. Because not every segment have only one neighbour. Can I solve the problem with the given functions?

  • How should the waterflow be calculated? Can you provide an example? :) – Joseph Aug 4 '17 at 9:33
  • In Segment 21 we have the water flow 2. The next segment will be No. 19. There isn't a value. So there should be the same value like in No. 21. and so on. Should be in the next segment an other water flow then before, the water flow should add up. For instance, segment 18 have the water flow 2 and meets in segment 17 of a water flow from 4. Then 4+2=6 – Chris Aug 4 '17 at 9:47
  • it will be difficult if two segments flow in one like No 11,12,13 – Chris Aug 4 '17 at 9:54
  • How do i say: show me all Downstream which are equal to segmentNo? in python? – Chris Aug 4 '17 at 13:37
  • You could use the field calculator expression: if("Downstream" = "segmentNo", 1, 0) which essentially gives a 1 if both values match, otherwise a 0. If you want a python solution, I would suggest you edit your question with the comments you made earlier and mention you're looking for a solution in creating a function using the Function Editor. – Joseph Aug 4 '17 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.