wind_direction
Calculate meteorological wind direction from zonal and meridional wind components.
Available in version 6.1.0 and later.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" function wind_direction ( u : numeric, ; float, double, integer only v : numeric, opt : integer ) return_val [dimsizes(u)] : float or double
Arguments
uA variable of any dimensionality containing the zonal wind component. Array size and shape must match v.
vA variable of any dimensionality containing the meridional wind component. Array size and shape must match u.
optA scalar which indicates how 'calm' (u=v=0) wind direction is returned. Currently, the only option is:
- opt=0: the returned wind direction will be 0.0
Return value
A multi-dimensional array of the same sizes as u. The output will be double if u or v is of type double. Otherwise, type float will be returned.
Description
Calculates meteorological wind direction using the zonal and meridional wind components.
See Also
atan2, wind_component, wind_speed, wind_stats
Examples
Example 1
u = (/ 10, 0, 0, -10, 10, 10, -10, -10, 0/) v = (/ 0, 10, -10, 0, 10, -10, 10, -10, 0/) wspd = wind_speed(u,v) wdir = wind_direction(u,v,0) print(sprintf("%7.2f", u)+sprintf("%7.2f", v)+sprintf("%7.2f", wspd)+sprintf("%7.2f", wdir))
The edited output is:
u v spd dir
(0) 10.00 0.00 10.00 270.00
(1) 0.00 10.00 10.00 180.00
(2) 0.00 -10.00 10.00 0.00
(3) -10.00 0.00 10.00 90.00
(4) 10.00 10.00 14.14 225.00
(5) 10.00 -10.00 14.14 315.00
(6) -10.00 10.00 14.14 135.00
(7) -10.00 -10.00 14.14 45.00
(8) 0.00 0.00 0.00 0.00