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-05-02" "2024-05-03" ...
## $ QN_3 : int 10 10 10 10 10 10 10 10 10 10 ...
## $ FX.Windspitze : num 14.8 10.5 6.7 13.6 7.4 9.1 7.5 6.4 6.8 8 ...
## $ FM.Windgeschwindigkeit : num 5.2 3.9 2.7 4.5 3.3 3 2.9 2.4 1.8 3.1 ...
## $ QN_4 : int 9 9 9 9 9 9 9 9 9 9 ...
## $ RSK.Niederschlagshoehe : num 0 1.5 0 0 0 0 0 0 0 0 ...
## $ RSKF.Niederschlagsform : int 0 6 0 6 0 0 0 0 0 0 ...
## $ SDK.Sonnenscheindauer : num 10.1 7.6 10.7 5.6 12.8 1.2 11.6 13.3 8.4 6 ...
## $ SHK_TAG.Schneehoehe : int 0 0 0 0 0 0 0 0 0 0 ...
## $ NM.Bedeckungsgrad : num 3 4.2 6.2 5.6 6.8 7.8 5.5 5.9 5.8 5.5 ...
## $ VPM.Dampfdruck : num 11.8 13.4 12.5 11.9 9.5 10 8.1 8.1 10.4 11.9 ...
## $ PM.Luftdruck : num 993 998 1003 997 998 ...
## $ TMK.Lufttemperatur : num 20 17.8 15.7 15.5 13.7 11.3 12.9 14.1 17.1 15.3 ...
## $ UPM.Relative_Feuchte : num 53 67 72 69 63 75 58 53 56 70 ...
## $ TXK.Lufttemperatur_Max : num 27.1 23 21.5 21.7 20 16.1 20.2 21 23.3 20.5 ...
## $ TNK.Lufttemperatur_Min : num 13.1 11.9 11 9.5 7.5 8.2 6.5 6.7 10.7 10.4 ...
## $ TGK.Lufttemperatur_5cm_min: num 9.2 9.1 10.1 4.9 3.2 4.1 3.5 2 7.9 5.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)