How can I calculate the difference (WD_Bias) in two wind directions (in degrees) in python so that the results range from -180 to 180? Here is the code I have so far? Does this seem to do what I want or am I missing something else?
WD_Bias = WD_model - WD_obs
WD_Bias[WD_Bias>180.]=360.-WD_Bias[WD_Bias>180.]
WD_Bias[WD_Bias<-180.]=WD_Bias[WD_Bias<-180.]+360.