1 subroutine da_uv_to_sd_lin(spd,dir,u,v,ub,vb)
2 !-----------------------------------------------------------------------
4 !-----------------------------------------------------------------------
8 real, intent(in) :: u, v
9 real, intent(inout) :: ub, vb
10 real, intent(out) :: spd, dir
12 if (trace_use_dull) call da_trace_entry("da_uv_to_sd_lin")
14 if ( (ub*ub+vb*vb) == 0.0 ) then ! Avoid division by zero
18 if (trace_use_dull) call da_trace_exit("da_uv_to_sd_lin")
21 if (abs(ub - 0.0) <= 0.1) ub = (ub/abs(ub))*0.1
22 if (abs(vb - 0.0) <= 0.1) vb = (vb/abs(vb))*0.1
24 spd = (ub*u+vb*v)/sqrt(ub*ub+vb*vb)
25 dir = (vb*u-ub*v)/(ub*ub+vb*vb) * 180.0/pi
27 if (trace_use_dull) call da_trace_exit("da_uv_to_sd_lin")
29 end subroutine da_uv_to_sd_lin