Hi Ken, What exactly do you mean by elevation drop (at each cell)? I can only guess…
Tom On Tue, Dec 15, 2020 at 1:10 PM Ken Mankoff <mank...@gmail.com> wrote: > > Specifically, I have outlets and basins. I can find the (x,y) location of > the outlet for every cell in each basin using the following code. Note that > I'm doing this for all cells in the basin, not just stream cells. The > r.stream.order does provide elev_drop. I'd like this for non-stream cells > too, for each basin. > > Assuming that I have a outlets with unique IDs, I can create basins for > each outlet with: > > # dir comes from r.stream.extract > r.stream.basins -m direction=dir points=outlets basins=basins > > g.copy basins,cat_x > g.copy basins,cat_y > > I can then export the x and y location of each outlet to a file: > > r.out.xyz input=outlets | awk -F'|' '{print $3, $1}' > ./tmp/outlets_x > r.out.xyz input=outlets | awk -F'|' '{print $3, $2}' > ./tmp/outlets_y > > I can then copy my basins (same categories as outlets) and change the > category to x and y. > > r.category map=cat_x rules=./tmp/outlets_x separator=space > r.category map=cat_y rules=./tmp/outlets_y separator=space > > Note: There is probably a way to combine the above r.out.xyz and > r.category commands so that I don't need to use a temporary disk file. > > Finally, convert x and y from category to value > > r.mapcalc "outlet_x = @cat_x" > r.mapcalc "outlet_y = @cat_y" > > > I can then use outlet_x and outlet_y, for example in r.mapcalc to find the > direct distance between each inland cell and the outlet: > > r.mapcalc "dist = (outlet_x^2 + outlet_y^2)^(0.5)" > > Rather than finding the distance from each inland cell to its outlet, I'd > like to find the elevation change from each inland cell to its outlet. Is > this possible to do efficiently in the Bash interface to GRASS? I can do it > with some loops in Python but prefer to stay in Bash if possible. > > Thanks, > > -k. > _______________________________________________ > grass-user mailing list > grass-user@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/grass-user > -- Thomas E Adams, III 1724 Sage Lane Blacksburg, VA 24060 tea...@gmail.com (personal) t...@terrapredictions.org (work) 1 (513) 739-9512 (cell)
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user