Visualising the seasonality of Atlantic windstorms

[This article was first published on mages' blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Last week Arthur Charpentier sketched out a Markov spatial process to generate hurricane trajectories. Here, I would like to take another look at the data Arthur used, but focus on its time component.

According to the Insurance Information Institute, a normal season, based on averages from 1980 to 2010, has 12 named storms, six hurricanes and three major hurricanes. The usual peak months of August and September passed without any major catastrophes this year, but the Atlantic hurricane season is not over yet.

So, let’s take a look at the data again, and here I will use code from Gaston Sanchez, who looked at windstorm data earlier.

I believe, I am using the same data as Arthur, but from a different source, which allows me to download it in one file (13.9MB). Using code from Gaston my chart of all named windstorms over the period of 1989 to 2013 looks like this.


Plotting the data by months illustrates the seasonality of windstorms during the year. Note, that there are no named windstorms for the months of February and March and although the season runs until the end of November, I can clearly see that the peak months are August and September.


Perhaps there are other time components that effect the seasonality across years, such as La Niña? Plotting the years 1989 to 2013 certainly shows that there are years with more windstorm activity than others. Critical to the impact and cost of windstorms is if they make landfall or not. Hence, I add information on deaths and economic damages for major hurricanes over that period from Wikipedia.


Although 1992 doesn’t show much windstorm activity, hurricane Andrew was the most expensive one to that date and changed the insurance industry significantly. Following hurricane Andrew insurance companies started to embrace catastrophe models.

The economic loss is a very poor proxy to the loss of lives. In 1998 Hurricane Mitch cost the lives of over 19,000, with most of them living in Honduras. The economic cost of $6.2bn looks small compared to the cost of Andrew six years earlier ($26.5bn).


Although over the last few years we have seen a fairly benign impact of windstorm activity, the next big event can have a much more sever impact than what we have seen historically, as the population (and economy) on the Gulf of Mexico has and is growing rapidly, 150% from 1960 to 2008 alone. A hurricane season causing damages over $200bn doesn’t look unreasonable anymore.

R Code

## Inspired by Gaston Sanchez: http://rpubs.com/gaston/hurricanes
## Load packages
library(maps)
library(ggplot2)
library(data.table)
myMonth <- function(x){
time.date = strsplit(x, " ")
iso.date = unlist(lapply(time.date, function(x) x[1]))
iso.month = substr(iso.date, 6, 7)
factor(iso.month, labels = c(month.name))
}
# Function to add footnote.
# Source: http://bigdata-analyst.com/
# best-way-to-add-a-footnote-to-a-plot-created-with-ggplot2.html
makeFootnote <- function(footnoteText = "magesblog.com",
size = 1, color = "black"){
require(grid)
pushViewport(viewport())
grid.text(label = footnoteText ,
x = unit(1,"npc") - unit(2, "mm"),
y = unit(2, "mm"),
just = c("right", "bottom"),
gp = gpar(cex = size, col = color))
popViewport()
}
## Load data
url.address <- paste0("ftp://eclipse.ncdc.noaa.gov/pub/ibtracs/v03r06/all/",
"csv/Allstorms.ibtracs_all.v03r06.csv.gz")
(fn <- paste0(tempfile(), ".csv.gz"))
download.file(url = url.address, destfile = fn )
system(paste("gunzip ", fn))
fn.csv <- gsub(".csv.gz", ".csv", fn)
## Skip a few rows as the header goes across several rows
dt <- fread(fn.csv, skip=10, select=1:18)
## Get column names
fread(fn.csv, nrows=3,select=1:18)
## Rename columns
myNames <- c("Season",
"Num", "Basin", "Sub_basin", "Name", "ISO_time", "Nature",
"Latitude", "Longitude", "Wind.kt", "Pressure.mb",
"Degrees_North", "Deegrees_East")
setnames(dt, paste0("V", c(2:12, 17, 18)), myNames)
# Filter out missing data and unnamed hurricanes
dt <- dt[Latitude > -999 & Longitude > -999 & Wind.kt>0 &
!Name %in% c("UNNAMED", "NONAME:UNNAMED"),
myNames, with=FALSE]
# Remove white space, add storm ID and add months
dt[, `:=`(Basin = gsub(" ", "", Basin),
ID = paste(Name, Season, sep = "."),
Month = myMonth(ISO_time))]
# Let's focus on the North Atlantic basin and data post 1989
dt <- dt[Season >= 1989 & Basin %in% "NA"]
seasonrange <- paste(range(dt[, Season]), collapse=" - ")
# Set up base map
map <- ggplot(dt, aes(x = Longitude, y = Latitude, group = ID)) +
geom_polygon(data = map_data("world"),
aes(x = long, y = lat, group = group),
fill = "gray25", colour = "gray10", size = 0.2) +
geom_path(data = dt, aes(group = ID, colour = Wind.kt), size = 0.5) +
xlim(-138, -20) + ylim(3, 55) +
labs(x = "", y = "", colour = "Wind \n(knots)") +
theme(panel.background = element_rect(fill = "gray10", colour = "gray30"),
axis.text.x = element_blank(), axis.text.y = element_blank(),
axis.ticks = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank())
png(file="Atlantic_Windstorms.png", width=800, height=500)
map + ggtitle(paste0("Atlantic named Windstorm Trajectories (",
seasonrange, ")\n"))
makeFootnote()
dev.off()
# Show hurricance tracks by month
mapMonth <- map + facet_wrap(~ Month) +
ggtitle(paste0("Atlantic named Windstorm Trajectories by Month (",
seasonrange, ")\n"))
png(file="Atlantic_Windstorms_by_Months.png", width=1000, height=600)
mapMonth
makeFootnote()
dev.off()
## Get names of major hurricanes, deaths and damages from Wikipedia
url <- "http://en.wikipedia.org/wiki/List_of_costliest_Atlantic_hurricanes"
library(XML)
page <- readLines(url)
AtlanticHurricanes <- data.table(
readHTMLTable(page, which=1)[,c("Name", "Damage\n(Billions USD)",
"Deaths",
"Season")])
setnames(AtlanticHurricanes, "Damage\n(Billions USD)", "Damage")
AtlanticHurricanes[,`:=`(Season = as.integer(as.character(Season)),
Deaths=NULL, Damage=NULL,
NameDamage = paste(Name, Damage, sep=": "),
NameDeaths = paste(Name, Deaths, sep=": "))]
AtlanticHurricanes <- AtlanticHurricanes[
order(Season, Name),
list(Name=paste(.SD[,Name], collapse="\n"),
NameDeaths=paste(.SD[,NameDeaths], collapse="\n"),
NameDamage=paste0(NameDamage, collapse="\n")),
by=Season]
AtlanticHurricanes <- AtlanticHurricanes[ Season >= min(dt[,Season])]
AtlanticHurricanes <- unique(AtlanticHurricanes[order(Season)])
mapYear <- map + facet_wrap(~ Season)
## Deaths by year
mapYearDeaths <- mapYear +
geom_text(aes(x=-135, y=50, label=NameDeaths, group=NULL, size=0.5,
hjust=0, vjust=1),show_guide = FALSE,
data=AtlanticHurricanes,
colour="white", inherit.aes=FALSE, parse=FALSE) +
ggtitle(
paste0("Atlantic named Windstorm Trajectories and Number of Deaths ",
"for major Hurricanes (", seasonrange, ")\n"))
png(file="Hurricane_Deaths_by_Year.png", width=1200, height=800)
mapYearDeaths
makeFootnote()
dev.off()
## Damage by year
mapYearDamage <- mapYear +
geom_text(aes(x=-135, y=50, label=NameDamage, group=NULL, size=0.5,
hjust=0, vjust=1),show_guide = FALSE,
data=AtlanticHurricanes,
colour="white", inherit.aes=FALSE, parse=FALSE) +
ggtitle(
paste0("Atlantic named Windstorm Trajectories and Damage ($bn) for ",
"major Hurricanes (", seasonrange, ")\n"))
png(file="Hurricane_Damage_by_Year.png", width=1200, height=800)
mapYearDamage
makeFootnote()
dev.off()

Session Info

R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets 
[7] methods   base     

other attached packages:
[1] XML_3.98-1.1     data.table_1.9.2 ggplot2_1.0.0   
[4] maps_2.3-7      

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4     gtable_0.1.2    
 [4] labeling_0.3     MASS_7.3-33      munsell_0.4.2   
 [7] plyr_1.8.1       proto_0.3-10     Rcpp_0.11.2     
[10] reshape2_1.4     scales_0.2.4     stringr_0.6.2   
[13] tools_3.1.1 

To leave a comment for the author, please follow the link and comment on their blog: mages' blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)