Looking at wind speeds as a function of time is informative and all, but in aviation another key thing to consider it the direction of the wind (a headwind during take-off and landing may not be such a bad thing). To show the direction of the wind by day I created a “wind Rose” based on these two very well written posts: https://www.r-bloggers.com/plot-a-wind-rose-in-r/ and http://stackoverflow.com/questions/17266780/wind-rose-with-ggplot-r in R.

From the previous post:


library(ggplot2)
library(scales) # for "scale_x_datetime(labels = date_format("%H:%M"))" in windtrend graph

# read in downloaded ASOS data
d <- read.csv("SET.txt", skip = 5, stringsAsFactors = F, na.strings = "M")

# convert time formating to POSIXct for graphiing
dt <- as.POSIXct(d$valid)

# date for faceting only
date <- strftime(dt, format = "%m-%d-%y")
date <- as.Date(date, format = "%m-%d-%y")

# extract data of interest (i.e. date, time, knots, and wind direction)
wind_data <- data.frame(date = date, time = dt, knots = d$sknt, direction = d$drct, stringsAsFactors = F)
wind_data <- wind_data[complete.cases(wind_data), ]

# narrow it down to previous week or so
wind_data <- subset(wind_data, date > as.Date("01-19-17", format = "%m-%d-%y"))
med <- median(wind_data$knots)

To create the actual wind rose:


# bin size (degree / bin)
deg <- 30
# define range in each bin
dir.breaks <- seq(0-(deg/2), 360+(deg/2),deg)

# break data in to each bin and clean up labels
wind_data$binned <- cut(wind_data$direction, breaks = dir.breaks, ordered_results = T)
bin_labels <- as.character(c(seq(0, 360-deg, by = deg),0))
levels(wind_data$binned) <- bin_labels

# define wind speed bins and break data into bins with clean labels
sped_bins <- seq(0, 16, 2)
sped_bins <- c(sped_bins, 50)
sped_labels <- paste(c(sped_bins[1:length(sped_bins)-1]), '-', c(sped_bins[2:length(sped_bins)]))
sped_labels[length(sped_labels)] <- paste(sped_bins[length(sped_bins) - 1], "+")
wind_data$knots_binned <- cut(wind_data$knots, breaks = sped_bins, labels = sped_labels, ordered_results = T, include.lowest = T)
# reverse the levels so the colors will make more sense
levels(wind_data$knots_binned) <- rev(levels(wind_data$knots_binned))
# graph rose plot (really just a bar plot on polar coordinate with some cleaning)
windrose <- ggplot(data = wind_data, aes(x = binned, fill = knots_binned)) + geom_bar(width = 1, size = .3, alpha=.8)
windrose <- windrose + scale_fill_brewer(palette = "Spectral", direction = 1, guide = guide_legend(title = "Knots"))
windrose + coord_polar(start = -(deg/2)*(pi/180)) + xlab("") + ylab("") + facet_wrap(~date)

wind rose.png
 

The wind rose plot still shows the same thing – it was windy on the day of my lesson and the wind came from mostly west and southwest. I suspect the main issue was with the southwest wind which would cause a crosswind in on the runway (the airport has N-S and E-W runway).

So that’s why my lesson got canceled…

 

Advertisements