Learn R Programming

rdwd (version 1.5.0)

readDWD.grib2: read nwp forecast data

Description

read gridded numerical weather prediction data. Intended to be called via readDWD().

Usage

readDWD.grib2(file, bargs = NULL, toraster = TRUE, quiet = rdwdquiet(), ...)

Arguments

file

Name of file on harddrive, like e.g. cosmo-d2_germany_regular-lat-lon_single-level_2021010100_005_T_2M.grib2.bz2

bargs

Named list of arguments passed to R.utils::bunzip2(), see gargs in readDWD.raster(). DEFAULT: NULL

toraster

Logical: convert rgdal::readGDAL output with raster::raster()? DEFAULT: TRUE

quiet

Silence readGDAL completely, including warnings on discarded ellps / datum. DEFAULT: FALSE through rdwdquiet()

Further arguments passed to rgdal::readGDAL(),

Value

rgdal or raster object, depending on toraster

See Also

readDWD() https://www.dwd.de/EN/ourservices/nwp_forecast_data/nwp_forecast_data.html https://www.dwd.de/EN/aboutus/it/functions/Teasergroup/grib.html

Examples

Run this code
# NOT RUN {
 # Excluded from CRAN checks, but run in localtests
# Deactivated 2021-04-08 since readDWD.grib2 -> rgdal::readGDAL -> Error:
# **.grib2 is a grib file, but no raster dataset was successfully identified.
warning("readDWD.grib2 is not tested due to unresolved problems.")
if(FALSE){
nwp_t2m_base <- "ftp://opendata.dwd.de/weather/nwp/icon-d2/grib/03/p"
nwp_urls <- indexFTP("", base=nwp_t2m_base, dir=tempdir())
nwp_file <- dataDWD(nwp_urls[6], base=nwp_t2m_base, dir=tempdir(),
                    joinbf=TRUE, dbin=TRUE, read=FALSE)
nwp_data <- readDWD(nwp_file, quiet=TRUE)
plotRadar(nwp_data, project=FALSE)

nwp_data_rgdal <- readDWD(nwp_file, toraster=FALSE)
sp::plot(nwp_data_rgdal)
}
# }

Run the code above in your browser using DataLab