[net.puzzle] average wind direction puzzle

richa@ios.UUCP (Rich Altmaier) (07/11/84)

Consider measuring wind direction with an instrument that gives compass
angles (e.g. 0..359 degrees).  Suppose you wish to take several readings
and give an average wind direction.  What's a good algorithm for this?

If you take a set of readings and just numerically average the values,
you may find you never get results near 0/360 and you get lobes near
180 (which won't be correct).  Consider a reading set such as
355, 359, 3, 1.  Average wind direction is about 359 degrees.

	R. Altmaier
	{qubix, oliveb, decwrl}!ios!richa

ron@brl-tgr.ARPA (Ron Natalie <ron>) (07/14/84)

Use vector math.  Set the magnitude of the vector to a constant.

-Ron

You can't cross an elephant with a mountain climber, because the climber is a
scaler.

markb@sdcrdcf.UUCP (07/16/84)

In article <146@ios.UUCP> richa@ios.UUCP (Rich Altmaier) writes:
>Consider measuring wind direction with an instrument that gives compass
>angles (e.g. 0..359 degrees).  Suppose you wish to take several readings
>and give an average wind direction.  What's a good algorithm for this?
>
>If you take a set of readings and just numerically average the values,
>you may find you never get results near 0/360 and you get lobes near
>180 (which won't be correct).  Consider a reading set such as
>355, 359, 3, 1.  Average wind direction is about 359 degrees.
>
>	R. Altmaier
>	{qubix, oliveb, decwrl}!ios!richa

Numerical average only presents a problem if the range of measured values
spans across the 0-360 boundry.  Assuming that all the measurements are
within 180 degrees of each other, (otherwise wind direction is not very
well defined), the following procedure should do what you want.

1) if measurements do not span 0 degrees use numerical average.

1) if they span 0 degrees add 180 modulo 360 to each measurement
	take the numerical average and subtract 180 modulo 360 from
	the result

Mark Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!markb

kaufman@uiucdcs.UUCP (07/16/84)

#R:ios:-14600:uiucdcs:40700011:000:121
uiucdcs!kaufman    Jul 16 11:27:00 1984

Try the direction whose sine and cosine are the averages of the sines and
cosines of the wind directions being averaged.

achut@callan.UUCP (Achut Reddy) (07/25/84)

From: richa@ios.UUCP (Rich Altmaier)
Organization: Integrated Office Systems, Cupertino CA

Consider measuring wind direction with an instrument that gives compass
angles (e.g. 0..359 degrees).  Suppose you wish to take several readings
and give an average wind direction.  What's a good algorithm for this?

If you take a set of readings and just numerically average the values,
you may find you never get results near 0/360 and you get lobes near
180 (which won't be correct).  Consider a reading set such as
355, 359, 3, 1.  Average wind direction is about 359 degrees.

	R. Altmaier
	{qubix, oliveb, decwrl}!ios!richa