Try to convert your directions in cartesian coordinates, this allows to calculate the dot product quite easily.
Using z for "up" and x for "north" (=> y is "west") and the notation (x,y,z):
(0,0,1) is pointing upwards
(sqrt(3/4),0,1/2) is pointing N, as y=0, z=sin(30°)=1/2 and the vector should be normalized.
(sqrt(3/8),sqrt(3/8),1/2) is pointing NW, calculated similar to the N-sensor just with the requirement x=y.
The other 6 sensors just have signs and coordinates swapped.