Suppose you have this data wsw w n w n w n w n w. How would you intepret it?.
I'd say that it is either totally unrealistic that the wind would shift through about 90 degrees every 5 seconds, or the vane is not up in the open. And BTW, wsw would not be valid since the OP has indicated using only eight directions.
And what about this wsw w w w w w n n n n ?
The result would be "w" or "n" depending upon whether you code it to pick the first most frequent reading or the last. Re-read what I posted.
You need to be careful not to adopt an interesting algorithm that gives useless results.
That process (but sampling every minute and reporting every half-hour) has been implemented in a system that has been running in the real world for the last two years. The results aren't useless.