Use cardinal directions instead of degrees for wind dir
Created by: Cassidy James Blaede
Wind dir is being reported in degrees, which is awkward in my opinion. Instead, it might be more useful to map that to cardinal directions like N, NE, E, SE, S, SW, W, NW.
Imported comments:
By Carlos Suárez (bitseater) on 2017-11-25T14:25:15.000Z
Got it!
private string cardinal(double grados) {
double val = Math.floor((grados / 22.5) + 0.5);
string[] arr = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"};
int index = (int)(val % 16);
return arr[index];
}