10 - use case: recent time series
download & read data
## rdwd::updateRdwd()
library(rdwd)
link <- selectDWD("Potsdam", res="daily", var="kl", per="recent")
clim <- dataDWD(link, force=NA, varnames=TRUE)
str(clim)
## 'data.frame': 550 obs. of 19 variables:
## $ STATIONS_ID : int 3987 3987 3987 3987 3987 3987 3987 3987 3987 3987 ...
## $ MESS_DATUM : Date, format: "2023-11-20" "2023-11-21" ...
## $ QN_3 : int 10 10 10 10 10 10 10 10 10 10 ...
## $ FX.Windspitze : num 11.1 8.7 9.8 21.8 21.1 11.1 6.9 10.2 12.8 11.9 ...
## $ FM.Windgeschwindigkeit : num 4.1 3.7 2.8 9 8 4.5 2.8 3.7 4 5.3 ...
## $ QN_4 : int 9 9 9 9 9 9 9 9 9 9 ...
## $ RSK.Niederschlagshoehe : num 26.4 0 0 2.1 1.8 3.6 0 6.6 0.5 1.3 ...
## $ RSKF.Niederschlagsform : int 6 6 0 6 8 8 8 8 7 8 ...
## $ SDK.Sonnenscheindauer : num 0 0 6 0 2.9 1 4.6 0 2.4 0 ...
## $ SHK_TAG.Schneehoehe : int 0 0 0 0 0 0 0 0 5 5 ...
## $ NM.Bedeckungsgrad : num 7.7 7.3 4.9 7.7 6.5 6.9 6.5 7.9 5.9 7.9 ...
## $ VPM.Dampfdruck : num 11.5 7.3 4.6 8.8 6.6 6 5.2 5.8 4.8 5 ...
## $ PM.Luftdruck : num 994 1004 1016 998 987 ...
## $ TMK.Lufttemperatur : num 9.2 3.7 -1.1 6.9 4 0.6 -0.3 -0.1 -2 -1.7 ...
## $ UPM.Relative_Feuchte : num 98 90 83 86 81 93 88 96 92 92 ...
## $ TXK.Lufttemperatur_Max : num 10.7 8.3 1.8 11 7.2 2.5 1.6 1.3 -0.7 0.4 ...
## $ TNK.Lufttemperatur_Min : num 8.1 -1.4 -3.7 0.4 0.2 -0.3 -1.9 -1.1 -4 -4.7 ...
## $ TGK.Lufttemperatur_5cm_min: num 7.6 -3.5 -6.6 0.1 -1.3 -2 -4.5 -2.7 -10.8 -7.9 ...
## $ eor : Factor w/ 1 level "eor": 1 1 1 1 1 1 1 1 1 1 ...
plot time series
par(mar=c(4,4,2,0.5), mgp=c(2.7, 0.8, 0), cex=0.8)
plot(clim[,c(2,14)], type="l", xaxt="n", las=1, main="Daily temp Potsdam")
berryFunctions::monthAxis() ; abline(h=0)
mtext("Source: Deutscher Wetterdienst", adj=-0.1, line=0.5, font=3)