Please disregard last message. The 'merge' tool example uses 'cat', but realized I can select on any table column, and the tool takes care of the multiple unconnected (different) streams/basins.
v.edit map=streams tool=merge where="hack == 1" v.edit map=streams tool=merge where="hack == 2" v.edit map=streams tool=merge where="hack == 3" and then calculate sinuosity with v.to.db map=streams option=sinuous columns=sinuosity Seems to work. Thank you, -k. On 2024-01-02 at 13:53 -07, Ken Mankoff <mank...@gmail.com> wrote... > 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. _______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user