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-06-18" "2024-06-19" ...
##  $ QN_3                      : int  10 10 10 10 10 10 10 10 10 10 ...
##  $ FX.Windspitze             : num  15.5 11.3 7.3 9.3 14.3 12.7 6.1 10.8 10.2 9.9 ...
##  $ FM.Windgeschwindigkeit    : num  2.4 3.6 2.3 3.5 5.5 4.2 1.9 4.2 4.6 2.9 ...
##  $ QN_4                      : int  9 9 9 9 9 9 9 9 9 9 ...
##  $ RSK.Niederschlagshoehe    : num  10.8 1.2 0 2.1 8.2 0 0 0 0 3.5 ...
##  $ RSKF.Niederschlagsform    : int  6 6 6 6 6 0 0 0 0 6 ...
##  $ SDK.Sonnenscheindauer     : num  7.3 2.6 11.9 4.2 4.6 6.7 12.1 15 15.2 6.3 ...
##  $ SHK_TAG.Schneehoehe       : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ NM.Bedeckungsgrad         : num  7.5 5.8 6.5 6.9 6.4 5.6 2.9 1.2 1.5 7.5 ...
##  $ VPM.Dampfdruck            : num  17 16.2 13.1 19.3 16.5 14.6 14.6 15.1 17.6 21.4 ...
##  $ PM.Luftdruck              : num  1002 1004 1010 1001 999 ...
##  $ TMK.Lufttemperatur        : num  19.6 15.8 17.3 20 18.8 18.6 19.4 21.3 24.5 23.8 ...
##  $ UPM.Relative_Feuchte      : num  77 90 69 82 77 69 67 62 60 73 ...
##  $ TXK.Lufttemperatur_Max    : num  27.4 18 23.6 26.4 22.7 23.2 25.3 27.6 31.2 29.8 ...
##  $ TNK.Lufttemperatur_Min    : num  14.6 11.8 10.4 15.6 14.8 14.9 13.6 14.5 16.8 19.8 ...
##  $ TGK.Lufttemperatur_5cm_min: num  11.8 8.7 6.8 13.8 12.1 12.1 11.2 11.7 14 18 ...
##  $ 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)