Artificial intelligent assistant

How to convert North/South and East/West velocities into a compass heading degrees? I am trying to write airplane tracking software and I need to turn North/South Velocity and East/West velocity into a 0-360 degree heading. For example: `Plane 1 is travelling North-West and has 220 mph groundspeed North/South and -440 mph groundspeed East/West. What is the heading in compass degrees and how do I calculate that?` edit: made example more specific to output heading in compass degree's

The angle you want is $$\tan^{-1}\frac{v_{SN}}{v_{WE}}$$

As for the quadrants, many programming languages have a two-argument arctangent function precisely so as to get you into the right quadrant without any effort and also handle the pathological cases of “due north” and “due south”. It is quite likely that Python does too.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e9549626c2f3a701d69313e9858401f9