<!--
%\VignetteEngine{knitr::knitr}
%\VignetteIndexEntry{NOAA storms}
%\VignetteEncoding{UTF-8}
-->

```{r echo=FALSE}
knitr::opts_chunk$set(
  fig.width = 10,
  comment = "#>", 
  warning = FALSE, 
  message = FALSE,
  cache = TRUE
)
```


NOAA storms data
======

Get NOAA wind storm tabular data, metadata, or shp files from International Best Track Archive for Climate Stewardship (IBTrACS).



Find out more about NOAA storms data at http://www.ncdc.noaa.gov/ibtracs/index.php?name=numbering

## Load rnoaa

```{r load}
library('rnoaa')
```

## Metadata

There are two datasets stored in the package. By default `storm_meta()` gives metadata describing columns of the datasets returned.

```{r}
head( storm_meta() )
```

Or you can get back a dataset of storm names, including storm ids and their names.

```{r}
head( storm_meta("storm_names") )
```

## Tabular data

You can get tabular data for basins, storms, or years, (or all data). `storm_data()` and the next function `storm_shp()` figure out what files to get, and gets them from an ftp server, and saves them to your machine. Do let us know if you have any problems with paths on your machine, and we'll fix 'em. The result from `storm_data()` is a `dplyr`-like data.frame with a easy summary that makes large datasets easy to view. 

First, by basin (one of EP, NA, NI, SA, SI, SP, or WP)

```{r}
storm_data(basin='WP')
```

Or by storm id, see `storm_meta('storm_names')` for storm ids and their names.

```{r}
storm_data(storm='1970143N19091')
```

Or by year, from 1842 to 2014.

```{r}
storm_data(year=1941)
```

## shp files

The result from `storm_shp()` is the path, and some metadata, for the shp files downloaded. You can read in the shp files separately with `storm_shp_read()`. 

```{r}
(res <- storm_shp(year=2013))
```

You can easily read in the data (or do it on your own), then do stuff with the data, like make a simple plot. 

```{r}
resshp <- storm_shp_read(res)
library("maps")
map()
points(resshp)
```
