Learn R Programming

rWind (version 0.3.0)

arrowDir: Arrow direction fitting for Arrowhead function

Description

arrowDir adapts wind direction value to be used by Arrowhead function from "shape" package to plot wind direction for each coordinate.

Usage

arrowDir(W)

Arguments

W

A data.frame obtained by function wind.fit. It should content a column named "dir".

Value

A vector with angles for each arrow to be plotted by Arrowhead.

Details

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.

References

"R Package shape: functions for plotting graphical shapes, colors..." Karline Soetaert

See Also

wind.fit, Arrowhead

Examples

Run this code
# NOT RUN {
# Download wind for Iberian Peninsula region at 2015, February 12, 00:00
# wind_data <- wind.dl(2015,2,12,0,-10,5,35,45)

data(wind_data)

# Fit downloaded dataset to be plotted
wind_fitted_data <- wind.fit(wind_data)

# Create a vector with wind direction (angles) adapted
alpha=arrowDir(wind_fitted_data)

# Now, you can plot wind direction with Arrowhead function from shapes package
#Load "shape package
#require(shape)
# plot(wind_data$lon, wind_data$lat, type="n")
# Arrowhead(wind_data$lon, wind_data$lat, angle=alpha, arr.length = 0.1, arr.type="curved")

# }

Run the code above in your browser using DataLab