rdwd (version 1.4.0)

readDWD.raster: read dwd gridded raster data

Description

Read gridded raster data. Intended to be called via readDWD(). Note that R.utils must be installed to unzip the .asc.gz files.

Usage

readDWD.raster(file, gargs = NULL, dividebyten, quiet = rdwdquiet(), ...)

Arguments

file

Name of file on harddrive, like e.g. DWDdata/grids_germany/seasonal/air_temperature_mean/ 16_DJF_grids_germany_seasonal_air_temp_mean_188216.asc.gz

gargs

Named list of arguments passed to R.utils::gunzip(). The internal defaults are: remove=FALSE (recommended to keep this so file does not get deleted) and skip=TRUE (which reads previously unzipped files as is). If file has changed, you might want to use gargs=list(skip=FALSE, overwrite=TRUE) or alternatively gargs=list(temporary=TRUE). The gunzip default destname means that the unzipped file is stored at the same path as file. DEFAULT gargs: NULL

dividebyten

Logical: Divide the numerical values by 10? DEFAULT: TRUE

quiet

Suppress subfunction name message? DEFAULT: FALSE through rdwdquiet()

Further arguments passed to raster::raster()

Value

raster::raster object

See Also

readDWD()

Examples

# NOT RUN {
 # Excluded from CRAN checks, but run in localtests

rasterbase <- paste0(gridbase,"/seasonal/air_temperature_mean")
ftp.files <- indexFTP("/16_DJF", base=rasterbase, dir=tempdir())
localfiles <- dataDWD(ftp.files[1:2], base=rasterbase, joinbf=TRUE,
                      dir=localtestdir(), read=FALSE)
rf <- readDWD(localfiles[1])
rf <- readDWD(localfiles[1]) # runs faster at second time due to skip=TRUE
raster::plot(rf)

plotRadar(rf,proj="seasonal", extent=rf@extent)

testthat::expect_equal(raster::cellStats(rf, range), c(-8.2,4.4))
rf10 <- readDWD(localfiles[1], dividebyten=FALSE)
raster::plot(rf10)
testthat::expect_equal(raster::cellStats(rf10, range), c(-82,44))
# }