---
title: "DWD weather stations"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{mapDWD}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

[rdwd main vignette](rdwd.html)

The `rdwd` package provides a collection of all the metafiles on the 
[DWD data server](ftp://ftp-cdc.dwd.de/pub/CDC/observations_germany/climate).
It is presented as an interactive map below.

When a point is clicked, an infobox should appear.
The first line can be copypasted into R to obtain more information on the available files.
The map is created with the following code:

```{r map, fig.height=7, fig.width=7, warning=FALSE}
library(rdwd)  ;  data(geoIndex)  ;  library(leaflet) 
leaflet(geoIndex) %>% addTiles() %>%
        addCircles(~lon, ~lat, radius=900, stroke=F, color=~col)%>%
        addCircleMarkers(~lon, ~lat, popup=~display, stroke=F, color=~col)
```

Open this vignette locally for faster map reaction times than on the CRAN html view:
```{r vignette_local, eval=FALSE}
vignette("mapDWD")
```

The blue dots mark stations for which recent files are available 
(with >=1 file in 'recent' folder or 'BIS_DATUM' later than one year ago).
The red dots mark all stations with only historical datasets.

To see only the stations with recent data, use the following code:

```{r onlyrecent, eval=FALSE}
library(rdwd)  ;  data(geoIndex)  ;  library(leaflet) 
leaflet(data=geoIndex[geoIndex$recentfile,]) %>% addTiles() %>%
        addCircleMarkers(~lon, ~lat, popup=~display, stroke=F)
```

To request the nonpublic datasets counted in the infobox, please contact <klima.vertrieb@dwd.de>.
(The DWD cannot publish all datasets because of copyright restrictions).

Note: `geoIndex` is created in the last section of 
[rdwd-package.R](https://github.com/brry/rdwd/blob/master/R/rdwd-package.R#L208).
