Calculate the resultant wind speed and direction from a collection of wind speeds and directions.

res_wind_speed(speed, dir, na.rm = TRUE)

res_wind_dir(speed, dir, na.rm = TRUE)

Arguments

speed

Wind speeds.

dir

Wind directions in degrees clockwise from north.

na.rm

A logical value indicating whether NA values should be stripped before the computation proceeds.

Value

res_wind_speed returns the resultant wind speed. res_wind_dir returns the resultant wind direction.

Details

Resultant wind speeds are vector-averaged. We first find the average values of the east-west and north-south components,

$$V_e = -\frac{1}{N} \sum u_i \sin(\theta_i)$$ $$V_n = -\frac{1}{N} \sum u_i \cos(\theta_i)$$

where \(u\) is the speed and \(\theta\) is the direction. The resultant speed and direction can then be calculated with

$$U_R = \sqrt{V_e^2 + V_n^2}$$ $$\theta_R = \textrm{arctan}(\frac{V_e}{V_n}) + 180$$

References

U.S. Environmental Protection Agency (2000). “Meteorological Monitoring Guidance for Regulatory Modeling Applications.” https://www.epa.gov/sites/production/files/2020-10/documents/mmgrma_0.pdf.

Examples

# opposite winds cancel out
res_wind_speed(1, c(0, 180))
#> [1] 6.123234e-17

# A scalar average would return 180 in this case. Resultant wind direction
# produces the correct value.
res_wind_dir(1, c(355, 5))
#> [1] 0