View source: R/wind_functions2.R
| arrowDir | R Documentation |
arrowDir adapts wind direction value to be used by Arrowhead function from "shape" package to plot wind direction for each coordinate.
arrowDir(W)
W |
An object of class |
Angle argument of Arrowhead function from "shape" package needs to be fed in an anti-clockwise way, relative to x-axis, in degrees 0,360. arrowDir function adapts wind direction provided by wind.fit (clockwise, relative to y-axis ) to requirements of Arrowhead.
A numeric vector with one angle per grid cell, in degrees
anticlockwise from the positive x-axis, for plotting with shape::Arrowhead().
For an rWind_series, only the first time step is used.
arrowDir function works always together with Arrowhead function from "shape" package.
Javier Fernández-López
Karline Soetaert (2017). shape: Functions for Plotting Graphical Shapes, Colors. R package version 1.4.3. https://CRAN.R-project.org/package=shape
wind.dl
data(wind.data)
# Create a vector with wind direction (angles) adapted
alpha <- arrowDir(wind.data)
# Plot arrows if the optional shape package is available
if (requireNamespace("shape", quietly = TRUE)) {
plot(wind.data$lon, wind.data$lat, type = "n")
shape::Arrowhead(wind.data$lon, wind.data$lat,
angle = alpha,
arr.length = 0.1, arr.type = "curved"
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.