We should write a consistent wind direction function, instead of writing it in several places. Here is a start
// Calculate wind direction from u and v components of wind.
// Wind direction is calculated in degrees in the meteorological sense. For example, a wind coming from the north has a wind direction of zero degrees.
// u and v components denote the horizontal and vertical components respectively and indicate the direction the wind is going. I.e. a wind coming from the north would have u = 0 and v < 0.
wind_direction = fmod( atan2(u, v) * Cst::to_deg + 180., 360.);
We should write a consistent wind direction function, instead of writing it in several places. Here is a start