5 Station selection

print_short in this chapter is just a helper function to replace dwdbase with --- for shorter output in the vignette.

5.1 by location

Weather stations can be selected geographically with the interactive map. All stations within a certain radius around a given lat-long position can be obtained with nearbyStations.

5.2 by ID

The DWD station IDs can be obtained from station names with findID:

## Potsdam 
##    3987
##               Koeln-Bonn Koeln-Botanischer Garten           Koeln-Porz-Eil 
##                     2667                     2665                     2666 
##          Koeln-Stammheim 
##                     2968

5.3 by name

File selection by station name/id and folder can happen directly with selectDWD. It is designed to be very flexible:

## [[1]]
## [1] "---/hourly/sun/historical/stundenwerte_SD_03987_18930101_20181231_hist.zip"
## 
## [[2]]
## [1] "---/hourly/sun/historical/stundenwerte_SD_05705_19510101_20181231_hist.zip"

If res/var/per are left NA, an interactive selection is opened with the available folder options for the given station.

The time period can be doubled to get both filenames:

## [1] "---/daily/kl/recent/tageswerte_KL_03987_akt.zip"                       
## [2] "---/daily/kl/historical/tageswerte_KL_03987_18930101_20181231_hist.zip"

There may be a differing number of available files for several stations across all folders. That’s why the default outvec is FALSE (unless per="hr").

## [[1]]
## [1] "---/annual/more_precip/historical/jahreswerte_RR_03467_19940101_20181231_hist.zip" 
## [2] "---/annual/more_precip/recent/jahreswerte_RR_03467_akt.zip"                        
## [3] "---/daily/more_precip/historical/tageswerte_RR_03467_19930601_20181231_hist.zip"   
## [4] "---/daily/more_precip/recent/tageswerte_RR_03467_akt.zip"                          
## [5] "---/monthly/more_precip/historical/monatswerte_RR_03467_19930601_20181231_hist.zip"
## [6] "---/monthly/more_precip/recent/monatswerte_RR_03467_akt.zip"                       
## 
## [[2]]
## [1] "---/annual/more_precip/historical/jahreswerte_RR_05116_19930101_20061231_hist.zip" 
## [2] "---/daily/more_precip/historical/tageswerte_RR_05116_19920701_20061231_hist.zip"   
## [3] "---/monthly/more_precip/historical/monatswerte_RR_05116_19920701_20061231_hist.zip"

5.5 metaIndex

selectDWD also uses a complete data.frame with meta information, metaIndex (derived from the “Beschreibung” files in fileIndex).

## 'data.frame':    97225 obs. of  12 variables:
##  $ Stations_id  : int  1 1 1 1 1 ...
##  $ von_datum    : Date, format: "1891-01-01" "1891-01-01" ...
##  $ bis_datum    : Date, format: "1985-12-31" "1985-12-31" ...
##  $ Stationshoehe: int  478 478 478 478 478 ...
##  $ geoBreite    : num  47.8 47.8 ...
##  $ geoLaenge    : num  8.85 8.85 ...
##  $ Stationsname : chr  "Aach" "Aach" ...
##  $ Bundesland   : chr  "Baden-Wuerttemberg" "Baden-Wuerttemberg" ...
##  $ res          : chr  "annual" "annual" ...
##  $ var          : chr  "more_precip" "more_precip" ...
##  $ per          : chr  "historical" "recent" ...
##  $ hasfile      : logi  TRUE FALSE TRUE ...

dataDWD can download (and readDWD can correctly read) such a data.frame from any folder on the FTP server:

## [1] "---/monthly/more_precip/historical/RR_Monatswerte_Beschreibung_Stationen.txt"

Meta files may list stations for which there are actually no files. These refer to nonpublic datasets (The DWD cannot publish all datasets because of copyright restrictions). To request those, please contact or .