[GRASS-user] Merging stream segments based on order
Ken Mankoff
mankoff at gmail.com
Tue Jan 2 12:53:56 PST 2024
Hi GRASS list,
I'd like to calculate stream sinuosity. I currently do this with:
v.to.db map=streams option=sinuous columns=sinuosity
But the 'streams' vector there is generated from
r.stream.order stream_rast=streams direction=fdir elevation=head accumulation=acc stream_vect=streams hack=hack shreve=shreve --o
And is made up of many segments. I'm therefore calculating sinuosity of each segment. I believe this underestimates sinuosity. For example, a stream can have many short straight lines (sinuosity 1), each connected at an angle (sinuosity >1). But the reported sinuosity is only 1 for each of the straight segments.
I'd like to merge all connected lines with say, hack order 1, and then calculate sinuosity for one much longer segment. The stream vector has many basins, so there are many hack=1 segments. The associated table has 40k rows. If I limit to where hack==1, there are 6k rows. hack==2 has 12k rows.
Can anyone suggest how I merge? Looping over basin seems inefficient. I see v.edit has a 'merge' tool, but it isn't clear to me how to find the cats I want to merge? For each segment I have:
cat|stream|next_stream|prev_str01|prev_str02|prev_str03|prev_str04|strahler|horton|shreve|hack|topo_dim|scheidegger|drwal_old|length|stright|sinosoid|cum_length|flow_accum|out_dist|source_elev|outlet_elev|elev_drop|out_drop|gradient|start_x|start_y|stop_x|stop_y|sinuosity|n_up
I could add two new new columns that are the out_x,out_y of the terminal outlet (direction = -1 from r.watershed), build a uniq ID from that pair, set that to the category of all of the segments, and then merge using that?
Thanks for any suggestions,
-k.
More information about the grass-user
mailing list