<div dir="ltr"><div>Hi Ken!</div><div><br></div><div>So, presumably, you know the locations of all the basin outlets (lat-long, e.g.). Using  <em><b>v.what.rast</b></em>, query the elevation map to get the elevation at the basin outlet (locations) that the vector points identify. This associates the basin outlet elevation with its location. Assuming you have a single elevation map, you'll need to mask the elevation map to use the method I suggested. You can get the basin boundary -- if these are not already identified -- to create a mask using <i><b>r.water.outlet</b></i>. For each basin, set the MASK and do the r.mapcalc calculation I proposed, because you know the outlet elevation and the elevation at all cells within the MASKed basin area. r.mapcalc will create a new map 'diff' comprised of the elevation differences between the elevation at the basin outlet and all other cells in the basin. The elevation difference at the basin outlet will be ZERO.</div><div><br></div><div>The whole process is easily scriptable. I have done this kind of thing a fair amount, FWIW...<br></div><div><br></div><div>Later, after all the diff maps have been created, you could (if you wanted/needed to) patch them together or do statistics on them, etc. I hope all this makes sense...<br></div><div><br></div><div>Best,</div><div>Tom<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 15, 2020 at 3:52 PM Ken Mankoff <<a href="mailto:mankoff@gmail.com">mankoff@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 2020-12-15 at 12:28 -08, Thomas Adams <<a href="mailto:tea3rd@gmail.com" target="_blank">tea3rd@gmail.com</a>> wrote...<br>
> So, if I understand, that seems pretty simple and could be done with<br>
> r.mapcalc:<br>
><br>
> diff = elev - outlet_elev<br>
><br>
> where elev is a raster map of elevations and outlet_elev is the elevation<br>
> at the basin outlet. Using a basin mask the calculation could be confined<br>
> to any basin of interest. But, I am probably missing something, I think…<br>
<br>
One of us is missing something, but I'm happy to assume it is me :).<br>
<br>
If outlet_elev is only defined at the outlets, diff is only defined at the outlets. I want it defined for every inland cell in every basin. I have 1,000s of basins.<br>
<br>
How do I define outlet_elev everywhere? I can do it now using r.stream.distance but prior to Anna suggesting that, I didn't know how to do it. Is there some trick like for each basin I set the category to the elevation of the outlet, and then use mapcalc @math function to create the outlet_elev raster? <br>
<br>
  -k.<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Thomas E Adams, III<div>1724 Sage Lane</div><div>Blacksburg, VA 24060</div><div><a href="mailto:tea3rd@gmail.com" target="_blank">tea3rd@gmail.com</a> (personal)</div><div><a href="mailto:tea@terrapredictions.org" target="_blank">tea@terrapredictions.org</a> (work)<br></div><div><br></div><div>1 (513) 739-9512 (cell)</div><div><br></div></div></div></div></div></div>