[GRASSLIST:8927] statistic mode

dear users....
I have a problem regarding the aspect map...
I need to obtain the main orientation of some slopes...
if I use the r.univar module to obtain the everage of the cells values,
I obtain false results, because, for example:
a slope degrading towards est is full of cells having values comprised
between 0 and 45 and comprised between 315 and 360... the average is
probably ~180.... exactly the opposite value I was looking for....

so I have thougth that I need probably the mode of the distribution,
i.e. the value of the cells which are more present in the map....

do you know how I can simply obtain the mode???
do you have a better solution

ivan

--
Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a
06125
Perugia (Italy)
e-mail: marchesini@unipg.it
        ivan.marchesini@gmail.com
tel: +39(0)755853760
fax: +39(0)755853756

I have a problem regarding the aspect map...
I need to obtain the main orientation of some slopes...
if I use the r.univar module to obtain the everage of the cells
values, I obtain false results, because, for example:
a slope degrading towards est is full of cells having values
comprised
between 0 and 45 and comprised between 315 and 360... the average is
probably ~180.... exactly the opposite value I was looking for....

so I have thougth that I need probably the mode of the distribution,
i.e. the value of the cells which are more present in the map....

do you know how I can simply obtain the mode???
do you have a better solution

devolve angles (assume radius of 1) into cartesian x,y components, find
mean of each, then convert result back to polar coordinates.

cart2pol: [use r.mapcalc]
x=cos(theta)
y=sin(theta)

pol2cart:
magnitude = sqrt(U_map^2 + V_map^2)
direction = atan(U_map, V_map)

Most likely better solutions are out there.

r.univar doesn't do mode, r.univar.sh does. r.univar.sh still exists
because r.univar has not yet been finished for advanced statistics like
mode and quartiles. (m

Hamish