<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="NO-BOK" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi Johannes,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">For more complex network analysis I can warmly recommend the igraph package (<a href="http://igraph.org/">http://igraph.org/</a>,
which has both Python and R bindings).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">It comes very handy for customized network analysis, is not too complicated to learn, well documented and quite efficient.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I could provide you with some sample code in R if that would be of interest.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Cheers<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Stefan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> grass-user-bounces@lists.osgeo.org [mailto:grass-user-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Johannes Radinger<br>
<b>Sent:</b> 18. mars 2015 10:30<br>
<b>To:</b> GRASS user list<br>
<b>Subject:</b> [GRASS-user] Stream order for vector networks<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I am interested in calculating stream order (Strahler, Shreve) for stream networks based on GRASS vector networks (e.g. created by
<a href="http://v.net">v.net</a>) without using the raster approach of the GRASS add-on r.stream.order. Therefore, I came across following paper:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black">Gleyzer, A., Denisyuk, M., Rimmer, A. and Salingar, Y. (2004), A FAST RECURSIVE GIS ALGORITHM FOR COMPUTING STRAHLER STREAM ORDER IN BRAIDED AND NONBRAIDED NETWORKS.
JAWRA Journal of the American Water Resources Association, 40: 937–946. doi: 10.1111/j.1752-1688.2004.tb01057.x</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">which also provides pseudocode to calculate Strahler order for non-braided and braided vector networks defined by arcs and nodes. Thus, I am wondering if it is possible to get the information from which node a specific arc starts (from_node)
and where it drains to (to_node). BTW, I seems some kind of this information is already provided with the NC-dataset (FNODE_ and TNODE column) in the streams attribute table, however I don't know where this information comes from. Of course to extract this
information the network needs to be directed to define what is the upstream and what the downstream node of each arc. However, having this information available, it should not be to complicated to apply the algorithm proposed by Gleyzer et al 2004. Thus I
am interested to get 'from_node' and 'to_node' information e.g. stored in the attribute table of
<a href="http://v.net">v.net</a> output?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Here the pseudocode provided by Gleyzer et al 2004:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">########################################################################<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">MakeDictionaries(Network)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">1 for each Arc <span style="font-family:"Cambria Math",serif">
∈</span> Network<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2 do FromNodesPerArc[Arc's ID] ← Arc’s FromNodeID<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">3 InflowingArcsPerNode[Arc's ToNodeID] ← InflowingArcsPerNode[Arc’s ToNodeID]
<span style="font-family:"Cambria Math",serif">∪</span> Arc’s ID<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">4 OriginatingNode[Arc's ID] ← Arc’s FromNodeID<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">StreamOrdering(ArcID)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">1 Visited[ArcID] ← true<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2 if | InflowingArcsPerNode[ FromNodesPerArc[ArcID] ] | = 0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">3 then StreamOrders[ArcID] ← 1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">4 else<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">5 for each Arc <span style="font-family:"Cambria Math",serif">
∈</span> InflowingArcsPerNode[ FromNodesPerArc[ArcID] ]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">6 do if not Visited[Arc]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">7 then UpstreamOrders[Arc] ← (StreamOrdering(Arc), OriginatingNode[Arc])<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">8 else UpstreamOrders[Arc] ← (StreamOrders[Arc], OriginatingNode[Arc])<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">9 MaxOrder ← 0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">10 MaxOrderCount ← 0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">11 for each (Order, Origin) <span style="font-family:"Cambria Math",serif">
∈</span> UpstreamOrders<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">12 do if Order > MaxOrder<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">13 then MaxOrder ← Order<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">14 MaxOrderCount ← 1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">15 MaxOrderOrigin ← Origin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">16 else if Order = MaxOrder<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">17 then if Origin ≠ MaxOrderOrigin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">18 then MaxOrderCount ← MaxOrderCount + 1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">19 if MaxOrderCount > 1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">20 then StreamOrders[ArcID] ← MaxOrder + 1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">21 OriginatingNode[ArcID] ← FromNodesPerArc[ArcID]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">22 else StreamOrders[ArcID] ← MaxOrder<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">23 OriginatingNode[ArcID] ← MaxOrderOrigin<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">24 if SegmentIDsPerOriginatingNode[ OriginatingNode[ArcID] ] = nil<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">25 then SegmentIDs[ StreamOrders[ArcID] ] ← SegmentIDs[ StreamOrders[ArcID] ] + 1<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">26 SegmentIDsPerOriginatingNode[ OriginatingNode[ArcID] ] ← SegmentIDs[ StreamOrders[ArcID] ]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">27 Segments[ArcID] ← SegmentIDsPerOriginatingNode[ OriginatingNode[ArcID] ]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">28 return StreamOrders[ArcID]<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">########################################################################<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Is there anyone having experience with that, or has already tried to implement a vector-stream order approach in GRASS GIS. Specifically I am interested<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">in Shreve stream order for simple (non-braided) stream networks and Strahler stream order for braided river networks (Gleyzer et al 2004).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Johannes<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>