Wind direction with a Letter instead of Degrees?

Hi, I am not very good with the text codes used in Kustom widgets. I'm trying to turn the wind direction (right now in degrees) into more standard N, S, E, W type letters. I'm not seeing it built in, but maybe it is? Or do I need some massively complicated if/then formula?

I want to do something like this: (From excel):


I don't think I would want 16 directions, 8 would be ideal.

Any thoughts from someone on how to do this? Thanks!

Nevermind, I think I answered my own question.

$if(wi(wdir)>337.5, N,wi(wdir)>292.5, NW,wi(wdir)>247.5, W,wi(wdir)>202.5, SW,wi(wdir)>157.5, S,wi(wdir)>112.5, SE,wi(wdir)>67.5, E,wi(wdir)>22.5, NE,N)$

Yep :) Nothing to add!