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: "2024-12-28" "2024-12-29" ...
## $ QN_3 : int 10 10 10 10 10 10 10 10 10 10 ...
## $ FX.Windspitze : num 2.6 11.1 12.5 12.4 20.5 24.3 20.7 13.2 12 17.1 ...
## $ FM.Windgeschwindigkeit : num 0.9 4 5.6 4.7 8.7 6.6 7.4 4.5 4.3 6.6 ...
## $ QN_4 : int 9 9 9 9 9 9 9 9 9 9 ...
## $ RSK.Niederschlagshoehe : num 0 0 0 0 1.1 0.2 0.7 0 14.1 1.3 ...
## $ RSKF.Niederschlagsform : int 0 0 0 0 6 8 8 8 8 6 ...
## $ SDK.Sonnenscheindauer : num 0 3 0 7 0 2.8 0.2 0 0 1.1 ...
## $ SHK_TAG.Schneehoehe : int 0 0 0 0 0 0 0 0 0 0 ...
## $ NM.Bedeckungsgrad : num 8 7.7 7.4 6 7.9 6.2 6.2 7.8 7.8 6.5 ...
## $ VPM.Dampfdruck : num 5.2 5.4 6.4 5.7 6.4 6.6 5.4 5.1 5 8.6 ...
## $ PM.Luftdruck : num 1018 1015 1014 1012 999 ...
## $ TMK.Lufttemperatur : num -1.7 -1.2 1.6 1 4.8 3.6 1 -0.3 -1.1 7.6 ...
## $ UPM.Relative_Feuchte : num 96 95 93 88 74 83 83 85 88 83 ...
## $ TXK.Lufttemperatur_Max : num -0.5 1.7 3.3 2.6 7.9 7.5 3.5 0.6 1.6 12 ...
## $ TNK.Lufttemperatur_Min : num -3.1 -4.3 -1.6 -1.7 1 1 -1.5 -0.9 -3.1 1.6 ...
## $ TGK.Lufttemperatur_5cm_min: num -3.5 -6.2 -4.2 -3.9 -0.6 -1.4 -3.9 -2.5 -4.3 0 ...
## $ 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)