Example 1: how to convert the wind from degrees to cardinal directions
Copy[{"id":"ab01324c.4824","type":"inject","z":"1d66267b.4c5caa","name":"","topic":"","payload":"90","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":100,"wires":[["3280794c.eb6396"]]},{"id":"3280794c.eb6396","type":"change","z":"1d66267b.4c5caa","name":"Convert Wind Direction in Degrees To Cardinal points","rules":[{"t":"set","p":"directions","pt":"flow","to":"$exists($flowContext(\"directions\")) ? $flowContext(\"directions\") : [\"N\", \"NNE\", \"NE\", \"ENE\", \"E\", \"ESE\", \"SE\", \"SSE\", \"S\", \"SSW\", \"SW\", \"WSW\", \"W\", \"WNW\", \"NW\", \"NNW\"] ","tot":"jsonata"},{"t":"set","p":"index","pt":"msg","to":"$string($floor((payload / 22.5) + 0.5) % 16)","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"$flowContext(\"directions[\"&index&\"]\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":100,"wires":[["10a54176.da8daf"]]},{"id":"10a54176.da8daf","type":"debug","z":"1d66267b.4c5caa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":120,"wires":[]}]
Example 2: how to convert the wind from degrees to cardinal directions
Dim Sector(17) As String * 3 = {"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW","N"}