New R package: load and chart oceanic storms

[This article was first published on Blog - BS, 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.

Mapping historical storms data is now a little bit easier. Off the back of this blog, I have authored an R package (available at basilesimon/noaastorms) that downloads, cleans and parses NOAA IBtrack data for you.

The National Oceanic and Atmospheric Administration releases datasets known as International Best Track Archive for Climate Stewardship.

These datasets are updated regulary and cover all our oceans. The data found in there is fantasticly detailed and goes back as far as 1850 in some case (I wonder how!).

How to install

library(devtools)
install_github("basilesimon/noaastorms")

Available functions

getStorms: Fetch NOAA historical best track storms data

> df <- getStorms(c('EP'))

> head(df[1:5])
     Serial_Num Season Num Basin Sub_basin    Name
2 1902276N14266   1902  01    EP        MM UNNAMED
3 1902276N14266   1902  01    EP        MM UNNAMED
4 1902276N14266   1902  01    EP        MM UNNAMED
5 1902276N14266   1902  01    EP        MM UNNAMED
6 1902276N14266   1902  01    EP        MM UNNAMED

The first argument is a vector of basin codes from this list:

  • NA: North Atlantic
  • SA: South Atlantic
  • NI: North Indian
  • SI: South Indian
  • EP: East Pacific
  • SP: South Pacific
  • WP: West Pacific

NOAA basins map

To get storms that took place in the Atlantic for example, run getStorms(c('NA', 'SA')).

The second (optional) argument is a date range to filter data with. For example:

dateRange <- c(as.Date('2010-01-01'), as.Date('2012-12-31'))
getStorms(c('NA', 'SA'), dateRange = dateRange)

Will query storms that took place in the Atlantic in 2010 and 2012.

Usage

# load a map of the world and
# use `clipPolys` to avoid issues
# when zooming in with `coord_map`
wm <- map_data("world")
library("PBSmapping")
data.table::setnames(wm, c("X","Y","PID","POS","region","subregion"))
worldmap <- clipPolys(wm,
  xlim=c(20,110),ylim=c(0, 45),
  keepExtra=TRUE)

# load storms for the Atlantic ocean
spStorms <- getStorms(c('NA', 'SA'))

ggplot(spStorms,
  aes(x = Longitude, y = Latitude,
    group = Serial_Num)) + 
  geom_polygon(data = worldmap,
    aes(x = X, y = Y, group = PID), 
    fill = "whitesmoke",
    colour = "gray10",
    size = 0.2) +
  geom_path(alpha = 0.1, size = 0.8,
    color = "red") +
  coord_map(xlim = c(20,110),
    ylim = c(0, 45)) 

Screenshot of storms

Your feedback is important

Next on the list are more complex queries. Sadly, supporting date ranges doesn't change how much data we need to download (the NOAA data is bulk export).

I maintain a list of open issues on Github and hope to capture some feature requests there.

If you have ideas, bug reports, feature requests, this is the place to go. Thank you!

To leave a comment for the author, please follow the link and comment on their blog: Blog - BS.

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)