readDWD {rdwd}R Documentation

Process data from the DWD CDC FTP Server

Description

Read climate data that was downloaded with dataDWD(). The data is unzipped and subsequently, the file(s) are read, processed and returned as a data.frame / terra raster object.

For observational data, new users are advised to set varnames=TRUE to obtain more informative column names.

readDWD will call internal (but documented) subfunctions depending on the argument type, see the overview in fileType().

Not all arguments to readDWD are used for all subfunctions, e.g. fread is used only by readDWD.data, while dividebyten is used in readDWD.raster and readDWD.asc.

file can be a vector with several filenames. Most other arguments can also be a vector and will be recycled to the length of file.

Usage

readDWD(
  file,
  type = fileType(file),
  varnames = FALSE,
  fread = NA,
  format = NA,
  tz = "GMT",
  hr = 0,
  dividebyten = TRUE,
  var = "",
  progbar = !quiet,
  quiet = rdwdquiet(),
  quietread = quiet,
  ...
)

Arguments

file

Char (vector): name(s) of the file(s) downloaded with dataDWD(), e.g. "~/DWDdata/tageswerte_KL_02575_akt.zip" or "~/DWDdata/RR_Stundenwerte_Beschreibung_Stationen.txt"

type

Character (vector) determining which subfunction to call. DEFAULT: fileType(file).

varnames

Logical (vector): Expand column names? Only used in readDWD.data(). DEFAULT: FALSE (for backward compatibility)

fread

Logical (vector): read fast? Used in readDWD.data(). DEFAULT: NA

format, tz

Format and time zone of time stamps, see readDWD.data()

hr

Integer code to merge historical and recent file. Used here, but documented in detail in readDWD.data(). DEFAULT: 0 (ignore argument)

dividebyten

Logical (vector): Divide the values in raster files by ten? That way, [1/10 mm] gets transformed to [mm] units. Used in readDWD.radar(), readDWD.raster() and readDWD.asc(). DEFAULT: TRUE

var

var for readDWD.nc(). DEFAULT: ""

progbar

Logical: present a progress bar with estimated remaining time? If missing and length(file)==1, progbar is internally set to FALSE, unless binary files are to be read. DEFAULT: !quiet

quiet

Logical: suppress messages? DEFAULT: FALSE through rdwdquiet()

quietread

Logical: suppress message like "Reading 1 file with readDWD.data() and fread=TRUE ...". DEFAULT: quiet

...

Further arguments passed to the internal ⁠readDWD.*⁠ subfunctions (see fileType) and from those to the underlying actual reading functions

Value

For observational data, an invisible data.frame of the desired dataset, or a named list of data.frames if length(file) > 1.
For gridded data, terra raster objects.

Author(s)

Berry Boessenkool, berry-b@gmx.de, Jul-Oct 2016, Winter 2018/19

See Also

dataDWD(), readVars(), readMeta(), selectDWD(), fileType()
https://bookdown.org/brry/rdwd

Examples

# see dataDWD and readDWD.* subfunctions


[Package rdwd version 1.8.0 Index]