<!--
%\VignetteEngine{knitr::knitr}
%\VignetteIndexEntry{Sea ice vignette}
%\VignetteEncoding{UTF-8}
-->

```{r echo=FALSE}
knitr::opts_chunk$set(
  comment = "#>", 
  collapse = TRUE,
  warning = FALSE, 
  message = FALSE
)
```

Sea ice vignette
======

Get sea ice data at <ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/shapefiles>

********************

```{r}
library('rnoaa')
library('dplyr')
library('ggplot2')
```

### Look at data for a series of years for Feb, South pole

```{r}
res <- sapply(seq(1986, 1990, 1), function(x) 
    sea_ice(x, month = 'Feb', pole = 'S'))
lapply(res, head)
```

### Map a single year/month/pole combo

```{r seaice1}
ggplot(res[[1]], aes(long, lat, group=group)) +
    geom_polygon(fill="steelblue") +
    theme_ice()
```

### Map all years for April only for North pole

```{r seaice2}
dat <- sea_ice(year = 1985:1990, month = 'Apr', pole = 'N')
df <- bind_rows(dat, .id = "x")
ggplot(df, aes(long, lat, group = group)) +
  geom_polygon(fill = "steelblue") +
  theme_ice() +
  facet_wrap(~ x)
```
