[GRASS-user] How to find elevation drop for all cells in a basin

Ken Mankoff mankoff at gmail.com
Wed Dec 16 10:34:07 PST 2020


I agree this would work. Given that I have 65036 basins, I was trying to avoid a loop. But if it's fast, who cares... I will try this method.

Thanks,

  -k.

On 2020-12-16 at 08:29 -08, Thomas Adams <tea3rd at gmail.com> wrote...
> Hi Ken!
>
> So, presumably, you know the locations of all the basin outlets
> (lat-long, e.g.). Using *v.what.rast*, 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 *r.water.outlet*. 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.
>
> The whole process is easily scriptable. I have done this kind of thing
> a fair amount, FWIW...
>
> 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...
>
> Best, Tom
>
> On Tue, Dec 15, 2020 at 3:52 PM Ken Mankoff <mankoff at gmail.com> wrote:
>
>>
>> On 2020-12-15 at 12:28 -08, Thomas Adams <tea3rd at gmail.com> wrote...
>> > So, if I understand, that seems pretty simple and could be done
>> > with r.mapcalc:
>> >
>> > diff = elev - outlet_elev
>> >
>> > where elev is a raster map of elevations and outlet_elev is the
>> > elevation at the basin outlet. Using a basin mask the calculation
>> > could be confined to any basin of interest. But, I am probably
>> > missing something, I think…
>>
>> One of us is missing something, but I'm happy to assume it is me :).
>>
>> 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.
>>
>> 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?
>>
>>   -k.
>>



More information about the grass-user mailing list