I had to deal with aspects of this when I was working with weather and water instrumentation back in 1976. At the time, I was with the Wyoming Water Resources Research Institute. We dealt with an enormous volume of meteorological and hydrological data.
A side note for/about the "Boys from Berkeley"--there's no reason for a "dead band" on a weather vane and hasn't been for several decades. (That isn't "bashing", is it, Melanie?)
For clarity, let's agree that a vane tells us direction and an anemometer tells us that air is moving, and how fast--that there is in fact wind!
A wind direction change of exactly 180 degrees in that short a period (3 seconds) is frankly unlikely unless the vane is spinning wildly and sampled at the wrong instant, or just turning lazily, moving almost at random. Most occurrences will be in very light, almost insignificant breezes (hence little or no wind speed), so direction doesn't really obtain.
I would "trap" such a condition by looking at the absolute (i.e., unsigned) value of the difference of every successive pair of readings. If it is 180, it's a null (i.e., useless and/or anomalous); discard the earliest value and use the second against the incoming third, and so forth--truly "rolling" the values through:
If |oldest - next| = 180, then oldest = next and next = newest, then start over; else, average the data and continue. (Melanie can probably write the code in about 15 seconds!)
What is overlooked in this discussion is the fact that wind "direction" means nothing if there is no air movement, i.e., no wind speed. Much more important than a possible but unlikely 180-degree anomaly is if the vane is simply sitting there in absolutely still air. It will continue to report a direction! This would be like your television weather reporter saying, "The wind is coming from the east at zero miles per hour." Huh?
Bookmarks