12 - use case: recent hourly radar files

Single RW files at ftp://ftp-cdc.dwd.de/weather/radar/radolan/rw should be read with the underlying readRadarFile that has been outsourced to dwdradar to keep the basic rdwd as lean as possible.

Since these datasets only exist for two days on the FTP Server, I’m storing them in tempdir().

Please note that for projecting (see projectRasterDWD), the radolan extent seems to be needed, not the rw extent.

rw_base <- "ftp://ftp-cdc.dwd.de/weather/radar/radolan/rw"
rw_urls <- indexFTP(base=rw_base, dir=tempdir(), folder="", exclude.latest.bin=TRUE)
rw_file <- dataDWD(rw_urls[8], base=rw_base, joinbf=TRUE, dir=tempdir(), read=FALSE, dbin=TRUE)

rw_orig <- dwdradar::readRadarFile(rw_file)
str(rw_orig)
## List of 2
##  $ dat : num [1:900, 1:900] NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ x.nrs: chr [1:900] "0" "1" "2" "3" ...
##   .. ..$ y.nrs: chr [1:900] "0" "1" "2" "3" ...
##  $ meta:List of 13
##   ..$ filename        : chr "C:/Users/Berry/AppData/Local/Temp/RtmpCuKxQt/raa01-rw_10000-2009202250-dwd---bin"
##   ..$ header          : chr "RW202250100000920BY1620153VS 3SW   2.28.1PR E-01INT  60GP 900x 900MF 00000001MS 70<asb,boo,ros,hnr,umd,pro,ess,"| __truncated__
##   ..$ nchar           : num 153
##   ..$ date            : POSIXlt[1:1], format: "2020-09-20 22:50:00"
##   ..$ product         : chr "RW"
##   ..$ location        : chr "10000"
##   ..$ radius_format   : chr " 3"
##   ..$ radolan_version : chr " 2.28.1"
##   ..$ precision       : num 0.1
##   ..$ interval_minutes: num 60
##   ..$ dim             : num [1:2] 900 900
##   ..$ radars          : chr "asb,boo,ros,hnr,umd,pro,ess,fld,drs,neu,nhb,oft,eis,tur,isn,fbg,mem"
##   ..$ radarn          : chr NA
# NB: this is an rw file, but needs radolan extent instead of rw
plotRadar(raster::raster(rw_orig$dat), extent="radolan", main=rw_orig$meta$date)