9 - use case: recent time series

download & read data

library(rdwd)
link <- selectDWD("Potsdam", res="daily", var="kl", per="recent")
file <- dataDWD(link, read=FALSE, dir="../localdata", force=NA, overwrite=TRUE)
clim <- readDWD(file, 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                : POSIXct, format: "2019-10-20" "2019-10-21" ...
##  $ QN_3                      : int  10 10 10 10 10 10 10 10 10 10 ...
##  $ FX.Windspitze             : num  8.7 6.1 6.1 8.6 8 11.8 11.6 14 13.8 5.8 ...
##  $ FM.Windgeschwindigkeit    : num  3.1 2.7 2.4 3.4 3 5 5.3 5.8 4.8 2.6 ...
##  $ QN_4                      : int  3 3 3 3 3 3 3 3 3 3 ...
##  $ RSK.Niederschlagshoehe    : num  0 0 0 0.2 0 0 0 1 0.9 0 ...
##  $ RSKF.Niederschlagsform    : int  0 0 0 6 6 0 0 6 6 0 ...
##  $ SDK.Sonnenscheindauer     : num  5.65 1.87 6.18 7.22 2.28 ...
##  $ SHK_TAG.Schneehoehe       : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ NM.Bedeckungsgrad         : num  6 6.4 4 4.4 6.1 5.7 5.1 6.1 2.7 4 ...
##  $ VPM.Dampfdruck            : num  13.4 14.6 12.8 12.7 14.4 12.5 12 10.4 8.9 7.9 ...
##  $ PM.Luftdruck              : num  999 1005 1012 1007 999 ...
##  $ TMK.Lufttemperatur        : num  14.6 14.1 12.6 11.9 13.1 13.3 13.4 11.1 7.4 4.8 ...
##  $ UPM.Relative_Feuchte      : num  80.8 90.5 88.2 91.1 95.3 ...
##  $ TXK.Lufttemperatur_Max    : num  19.8 18 17.3 17 16.6 18.2 17 15.9 11.7 9.1 ...
##  $ TNK.Lufttemperatur_Min    : num  11.2 10.9 8.4 7.6 10.4 10.5 9.8 5.7 4.5 0.8 ...
##  $ TGK.Lufttemperatur_5cm_min: num  8.8 7.9 5.3 4.8 7.3 7.5 7.1 2.5 1.8 -2.5 ...
##  $ 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)