function [spd,dir] = uv_to_sd(U,V)
%{
    Computes wind speed and direction from wind components U and V,
    where U is defined as positive for wind blowing S-to-N and V is
    positive for wind blowing E-to-W.  This is a right-handed convention
    and is the normal format for sonic anemometer wind components in
    all NOAA/PSD flux scripts.

    If U,V are true (earth) coordinates, spd/dir is true wind.
    If U,V are in ship coordinates (raw sonic wind), spd/dir is relative wind.

    dir format is the direction wind is coming FROM, 0-360 deg.

    Jan 2016, BWB
%}

spd = sqrt(U.^2 + V.^2);
dir = atan2(-V, U)*180/pi + 180;

end
