windSupport: Calculate wind support or crosswind

Description Usage Arguments Value Examples

View source: R/windSupport.R

Description

This function calculates the wind support based on the ground direction and speed (e.g. of an animal track) and the wind direction and speed. The wind support can be positive (tailwinds) or negative (headwinds). Logical wind speed and ground speed should be in the same unit (e.g. m/s)

Usage

1
windSupport(g_direction, g_speed, w_direction, w_speed, crosswind = FALSE)

Arguments

g_direction

The bearing (Can be calculated based on two points using the function bearing)

g_speed

The ground speed (Can be calculated as distance (between two points) / time (between two points))

w_direction

Can be calculated from u and v wind component: atan2(u, v)

w_speed

Can be calculated from u and v wind component: sqrt(u^2 + v^2)

crosswind

If TRUE the function returns the cross wind instead of the wind support

Value

Wind support or cross wind

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example 1
windSupport(g_direction = 0, g_speed = 15, w_direction = 1, w_speed = 5)
windSupport(g_direction = 0, g_speed = 15, w_direction = 1, w_speed = 5, crosswind = TRUE)

# Example 2: constant ground direction, different wind direction
d = data.table(w_direction = seq(-pi, pi, pi/24),
               w_speed     = rep(5, 49),
               g_direction = rep(0, 49),
               g_speed     = rep(15, 49) )

               d[, Ws := windSupport(g_direction, g_speed, w_direction, w_speed),
                   by = 1:nrow(d)]
               d[, Wc := windSupport(g_direction, g_speed, w_direction, w_speed,
                   crosswind = TRUE), by = 1:nrow(d)]

               plot(Ws ~ w_direction, d, type = 'l', ylab = 'Ws (black) / Wc (red)',
                         xlab = 'Wind direction')
               lines(Wc ~ w_direction, d, col = 'red')

mpio-be/windR documentation built on Feb. 2, 2020, 10:04 a.m.