5 Station selection
print_short
in this chapter is just a helper function to replace dwdbase with ---
for shorter output.
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:
# inputs can be vectorized, and period can be abbreviated:
selectDWD(c("Potsdam","Wuerzburg"), res="hourly", var="sun", per="hist") %>% print_short
## [1] "---/hourly/sun/historical/stundenwerte_SD_03987_18930101_20231231_hist.zip"
## [2] "---/hourly/sun/historical/stundenwerte_SD_05705_19510101_20231231_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/historical/tageswerte_KL_03987_18930101_20231231_hist.zip"
## [2] "---/daily/kl/recent/tageswerte_KL_03987_akt.zip"
There may be a differing number of available files for several stations across all folders.
## [1] "---/annual/climate_indices/precip/historical/jahreswerte_RRINDEX_03467_19940101_20221231_hist.zip"
## [2] "---/annual/climate_indices/precip/historical/jahreswerte_RRINDEX_05116_19930101_20061231_hist.zip"
## [3] "---/annual/climate_indices/precip/recent/jahreswerte_RRINDEX_03467_akt.zip"
## [4] "---/annual/more_precip/historical/jahreswerte_RR_03467_19930601_20221231_hist.zip"
## [5] "---/annual/more_precip/historical/jahreswerte_RR_05116_19920701_20061231_hist.zip"
## [6] "---/annual/more_precip/recent/jahreswerte_RR_03467_akt.zip"
## [7] "---/daily/more_precip/historical/tageswerte_RR_03467_19930601_20231231_hist.zip"
## [8] "---/daily/more_precip/historical/tageswerte_RR_05116_19920701_20061231_hist.zip"
## [9] "---/daily/more_precip/recent/tageswerte_RR_03467_akt.zip"
## [10] "---/daily/more_weather_phenomena/historical/wetter_tageswerte_RR_03467_19930601_20111031_hist.zip"
## [11] "---/daily/more_weather_phenomena/historical/wetter_tageswerte_RR_05116_19920701_20061231_hist.zip"
## [12] "---/monthly/climate_indices/precip/historical/monatswerte_RRINDEX_03467_19930601_20221231_hist.zip"
## [13] "---/monthly/climate_indices/precip/historical/monatswerte_RRINDEX_05116_19920701_20061231_hist.zip"
## [14] "---/monthly/climate_indices/precip/recent/monatswerte_RRINDEX_03467_akt.zip"
## [15] "---/monthly/more_precip/historical/monatswerte_RR_03467_19930601_20221231_hist.zip"
## [16] "---/monthly/more_precip/historical/monatswerte_RR_05116_19920701_20061231_hist.zip"
## [17] "---/monthly/more_precip/recent/monatswerte_RR_03467_akt.zip"
Since version 1.3.26 (2020-07-20), SelectDWD
collects warnings from the loop into a single message:
# out of 43 stations with a partial match for the name "Berlin", only 20 have data in the folowing folder
bd <- selectDWD("Berlin", exactmatch=FALSE, res="monthly", var="kl", per="h", quiet=FALSE)
## Warning: rmarkdown::render_site -> generator$render -> in_dir -> knitr::knit ->
## process_file -> handle_error -> process_group -> process_group.block ->
## call_block -> block_exec -> selectDWD -> force -> findID: ID determined from
## name 'Berlin' has 94 elements (394, 395, 399, 400, 401, 402, 403, 404, 405,
## 406, 407, 408, 409, 410, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422, 424,
## 425, 426, 427, 429, 430, 432, 433, 434, 435, 436, 437, 3147, 4537, 4751, 4894,
## 5138, 5432, 6193, 15186, 17444, 17445, 17446, 17447, 17448, 17449, 17450,
## 17451, 17452, 17453, 17454, 17455, 17456, 17457, 17458, 17459, 17460, 17461,
## 17462, 17463, 17464, 17465, 17466, 17467, 17468, 17469, 17470, 17471, 17472,
## 17473, 17474, 17475, 17476, 17477, 17478, 17479, 17480, 17481, 17482, 17483,
## 17484, 17485, 17486, 17487, 17488, 17489, 17490, 17491, 19897, 19898).
## chr [1:24] "---/monthly/kl/historical/monatswerte_KL_00395_19480701_19531231_hist.zip" ...