.. _wind_data: Wind Data ==================== Wind speed conversion --------------------- WindKit makes it easy to convert wind speed (magnitude) and direction to wind velocity vectors (U and V components) and vice versa. .. ipython:: python :okwarning: import numpy as np import windkit as wk ws = np.array([5, 10, 15]) # Wind speed in m/s wd = np.array([0, 45, 225]) # Wind direction in degrees u, v = wk.wind_vectors(ws, wd) We can visualize the wind vectors using matplotlib: .. ipython:: python :okwarning: import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot([0, u[0]], [0, v[0]], marker="o") ax.plot([0, u[1]], [0, v[1]], marker="o") @savefig wind_vectors.png width=6in ax.plot([0, u[2]], [0, v[2]], marker="o") Converting back to wind speed and direction. .. ipython:: python :okwarning: ws_converted, wd_converted = wk.wind_speed_and_direction(u, v) print(np.allclose(ws, ws_converted)) print(np.allclose(wd, wd_converted)) .. wind_speed .. wind_direction .. wind_speed_and_direction .. wind_vectors .. wind_direction_difference .. wd_to_sector .. vinterp_wind_direction .. vinterp_wind_speed .. rotor_equivalent_wind_speed