15 - use case: daily radar files
Download and read with readDWD.radar
with dividebyten=TRUE
:
# library("rdwd")
<- paste0(gridbase,"/daily/radolan/recent/bin/")
radbase <- format(Sys.Date()-5, "raa01-sf_10000-%y%m%d1450-dwd---bin.gz")
radfile <- dataDWD(radfile, base=radbase, joinbf=TRUE, dir=locdir()) rad
Project and then plot:
<- projectRasterDWD(rad$dat)
radp plotRadar(radp, main=paste("mm in 24 hours preceding", rad$meta$date), project=FALSE)
Save the projected radar image as NCDF file, read back and plot (not executed):
::writeRaster(radp, "rad_0714_2350.nc", format="CDF", overwrite=TRUE,
rastervarname="pre", varunit="mm/day", longname="precipitation24hrs",
xname="X", yname="Y",zname="nbands", zunit="numeric")
<- ncdf4::nc_open("rad_0714_2350.nc")
nc
nc<- ncdf4::ncvar_get(nc, "pre")
pre <- nc$dim$X$vals
lon <- nc$dim$Y$vals
lat image(lon, rev(lat), pre[,ncol(pre):1]) # takes several seconds
::addBorders() rdwd