[GRASSLIST:1666] Re: Using atan function

Glynn Clements glynn.clements at virgin.net
Tue Nov 4 07:26:50 EST 2003

temiz wrote:

> I want to make sure that using atan function.
> I have two maps containing sin and cosine values in radian.

sine and cosine aren't angles, so they aren't "in radians" (or
anything else).

> Using atan function in r.mapcalc is correct in this way:
> r.mapcalc dene='atan(map_cosine*180/3.14,map_sine*180/3.14)' ?

If you want the result in degrees:

	r.mapcalc 'dene=atan(map_cosine,map_sine)'

For radians:

	r.mapcalc 'dene=atan(map_cosine,map_sine)*3.14/180'

There is no point scaling the sine/cosine values, although it won't
make any difference as atan(y*k,x*k) == atan(y,x) for all k > 0.

[Aside: does r.mapcalc need a pi() function? Or deg2rad()/rad2deg()
functions? Or, for that matter, anything else?]

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-user mailing list