17 - use case: recent hourly radar files

Single RW files at https://opendata.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://opendata.dwd.de/weather/radar/radolan/rw"
rw_urls <- indexFTP(base=rw_base, dir=tempdir(), folder="", exclude.latest.bin=TRUE)
rw_file <- dataDWD(rw_urls[14], base=rw_base, joinbf=TRUE, dir=tempdir(), read=FALSE)
rw_file_actual <- R.utils::bunzip2(rw_file) # zipped since between 2022-06 and 2023-04

rw_orig <- dwdradar::readRadarFile(rw_file_actual)
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 "/private/var/folders/lf/4cpm3h3n6b3ddf_t8t_55x1h0000gn/T/RtmpSfA9OH/raa01-rw_10000-2401020920-dwd---bin"
##   .. ..- attr(*, "nbrOfBytes")= num 1620153
##   ..$ header          : chr "RW020920100000124BY1620153VS 3SW   2.29.1PR E-01INT  60GP 900x 900MF 00000001MS 70<asb,boo,ros,hnr,umd,pro,ess,"| __truncated__
##   ..$ nchar           : num 153
##   ..$ date            : POSIXlt[1:1], format: "2024-01-02 09:20:00"
##   ..$ product         : chr "RW"
##   ..$ location        : chr "10000"
##   ..$ radius_format   : chr " 3"
##   ..$ radolan_version : chr " 2.29.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(terra::rast(rw_orig$dat), extent="radolan", main=rw_orig$meta$date)