I want to plot some data of wind speed and direction on a wind rose (polar rose plot), but it seems that the library I am using (windrose) doesn't like when you feed it a negative wind direction. Thus, I am trying to add 360 degrees to all the negative values, thinking that it should plot. I tried doing the method shown in this post, if else in a list comprehension, but I still have plenty of negative numbers in my array.
wind_speed=np.sqrt(u**2+v**2)
wind_dir_calc=np.arctan(v/u)
wind_dir=np.degrees(wind_dir_calc)
[x+360 if x<0 else x+0 for x in wind_dir]
np.set_printoptions(threshold=np.inf)
print(wind_dir)
Sample output:
[-6.34019175 84.6607632 -58.73626831 55.40771131 73.87242417
66.70543675 48.0127875 50.71059314 52.27500496 38.15722659
37.50414236 48.14495746 -2.20259816 16.53483786 38.75162833
19.0466243 -58.67130713 -63.00416161 -65.41842552 -74.96956948
-74.23281746 -68.36911316 -46.46880071 -83.26398879 -80.75388725...]