16-wind Compass Rose
The eight principal winds (or main winds) are the four cardinals and four ordinals considered together, that is: N, NE, E, SE, S, SW, W, NW.
The eight half-winds are the direction points obtained by bisecting the angles between the principal winds. The half-winds are north-northeast (NNE), east-northeast (ENE), east-southeast (ESE), south-southeast (SSE), south-southwest (SSW), west-southwest (WSW), west-northwest (WNW) and north-northwest (NNW).
The eight principal winds and the eight half-winds together form the 16-wind compass rose, with each compass point at a 22 1⁄2° angle from its two neighbours.
BOM data in Australia presents wind direction in Cardinal format (e.g, "NNE" ). To generate a windrose chart in eagle.io you need degree data.
The following program will run in a process parameter to convert a text direction, e.g "NNE", to its degrees representation.
var direction = NODE("textDirection");
var arr = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"];
var index = arr.indexOf(direction.currentValue);
var degrees = index * 22.5;