Hello. I have used r.slope.aspect to generate a raster map of
slopes. The map has labeled each point with slope in degrees.
I would like to get slope as the tangent of the degrees. I used
r.mapcalc, and used the equation:
tan.0 = tan(@slope.0)
where tan.0 is my output map and slope.0 is the raster map with
slopes. However, I get tangent values equal to either zero or
one, and no fractional values. Can anyone help?
John Stamm
Grass only stores integers (for now???) So it's truncating all your
values to either 0 or 1. To preserve decimal places, multiply your
equation by say 1000 to retain 3 decimal places of information. Then
you'll need to divide any subsequent use of that raster by 1000 to use
the data correctly. I've also found that you should include a decimal
point after 1000 to make sure that the calculations are done as floating
point values rather than integers before truncation.
Your revised equation might look something like this:
r.mapcalc tan.0 = "tan(@slope.0) * 1000."
This technique has worked for me. Hope it helps you.
Ann McManamon
NOHRSC -NWS
6301 34th Ave. South
Minneapolis MN 55450
(612) 725 -3007
am@snow.nohrsc.nws.gov
On Tue, 13 Dec 1994, John Stamm wrote:
Hello. I have used r.slope.aspect to generate a raster map of
slopes. The map has labeled each point with slope in degrees.
I would like to get slope as the tangent of the degrees. I used
r.mapcalc, and used the equation:
tan.0 = tan(@slope.0)
where tan.0 is my output map and slope.0 is the raster map with
slopes. However, I get tangent values equal to either zero or
one, and no fractional values. Can anyone help?
John Stamm