VARIANCE OF ANGLES

From owner-grassu@isis.cecer.army.mil Sat Dec 14 01:19 eur 1996
X-Authentication-Warning: isis.cecer.army.mil: listserv set sender to grassu using -f
From: Giovanna Ranci <ranci@quercia.elet.polimi.it>
Subject: VARIANCE OF ANGLES
To: grassu@cecer.army.mil
Date: Fri, 13 Dec 96 19:35:28 MET
Mailer: Elm [revision: 70.85]

I need a FORMULA to calculate VARIANCE when arguments are ANGLES (in degree).
For example, I need to calculate variance of aspect map in 3x3 neighborhood.
Aspect is expressed in degrees. It's clear that a cell with value 5 and a cell with value 355 are almost the same aspect so variance formula has to consider it.
I got already a formula with sin and cosine but there should be some mistakes in it
(I calculate variance using command r.mapcalc and r.neighbors but results are strange...definetely unreal. I'm sure error is in the formula not in my procedure in Grassland).
If somebody knows the rigth formula, I will be glad to receive it.
Thanks,

Giovanna Ranci Ortigosa
e-mail: ranci@quercia.elet.polimi.it

It's a long time since I had trigonometry at school, but isn't it possible
to recalculate the aspect map in radians and calculate the variance from
that?

Philip Verhagen

                  -----------------------------------

                     philip@raap2.ivambv.uva.nl

                              R A A P

                        Plantage Muidergracht 14
                          1018 TV Amsterdam
                           The Netherlands

                        tel: +31 (20) 421 62 00
                        fax: +31 (20) 421 42 90

                http://raap2.ivambv.uva.nl/home_eng.html

                  -----------------------------------

> I need a FORMULA to calculate VARIANCE when arguments are ANGLES (in degree).
> For example, I need to calculate variance of aspect map in 3x3 neighborhood.
> Aspect is expressed in degrees. It's clear that a cell with value 5 and a cell with value 355 are almost the same aspect so variance formula has to consider it.
> I got already a formula with sin and cosine but there should be some mistakes in it
> (I calculate variance using command r.mapcalc and r.neighbors but results are strange...definetely unreal. I'm sure error is in the formula not in my procedure in Grassland).

It's a long time since I had trigonometry at school, but isn't it possible
to recalculate the aspect map in radians and calculate the variance from
that?

I think radians has the same problem. No matter what system you use to
treat aspect as a single number, there will always be an angle that
splits the unit circle (0 for degrees, Pi for radians).

You might try a different approach: measure the variance for both dx and
dy. For example:

r.mapcalc dx = "100 * cos(aspect)"
r.mapcalc dy = "100 * sin(aspect)"

Thus, the aspect is now represented as the vector dx,dy (times 100
thanks to the integer problem). In my opinion, a better representation
would be to calculate the vector normal of each cell:

r.mapcalc dx = "100 * cos(aspect) * sin(slope)"
r.mapcalc dy = "100 * sin(aspect) * sin(slope)"
r.mapcalc dz = "100 * cos(slope)"

From those values, you can measure the angle of importance. For example,

the angle between the vector normal and the angle of the sun could
determine solar insolation if your interested in modeling microclimate.

WARNING: the grass commands above will not generate expected results
from the maps coming out of r.slope.aspect. You will need to include
conditional statements and/or the "@" sign to represent actual slope and
aspect values.

Sincerely, chuck

--
Charles Ehlschlaeger http://geo.swf.uc.edu/chuck/
Assistant Research Professor chuck@geo.swf.uc.edu
Department of Geography (131) work: 513-556-2849
University of Cincinnati fax: 513-556-3370
Cincinnati, OH 45221-0131

             "It's an e-mail message.
      It's supposssed to have spelling errors"