Learn R Programming

rdwd (version 0.10.2)

readDWD: Process data from the DWD CDC FTP Server

Description

Read climate (meta) data that was downloaded with dataDWD. The file is read, processed and returned as a data.frame. file can be a vector with several filenames. The arguments meta and format can also be a vector and will be recycled to the length of file. If meta=TRUE, column widths for read.fwf are computed internally. If needed, readDWD tries to set the locale to German (to handle Umlaute correctly). They can then be processed with dd$Stations_id <- berryFunctions::convertUmlaut(dd$Stations_id).

Usage

readDWD(file, meta = grepl(".txt$", file), fread = FALSE, minfo = FALSE,
  format = NA, tz = "GMT", progbar = TRUE)

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"

meta

Logical (vector): is the file a meta file (Beschreibung.txt)? DEFAULT: TRUE for each file ending in ".txt"

fread

Logical: read faster with data.table::fread? For 30 daily/kl/hist files, 7 instead of 10 seconds. NA can also be used, which means TRUE if data.table is available. DEFAULT: FALSE

minfo

Logical: read the meta info txt files in the zip folder (instead of actual data)? Returns a named list of data.frames. DEFAULT: FALSE

format

Char (vector), only used if meta=FALSE: Format passed to as.POSIXct (see strptime) to convert the date/time column to POSIX time format. If NULL, no conversion is performed (date stays a factor). If NA, readDWD tries to find suitable format based on the number of characters. DEFAULT: NA

tz

Char (vector): time zone for as.POSIXct. "" is the current time zone, and "GMT" is UTC (Universal Time, Coordinated). DEFAULT: "GMT"

progbar

Logical: present a progress bar with estimated remaining time? If missing and length(file)==1, progbar is internally set to FALSE. DEFAULT: TRUE

Value

Invisible data.frame of the desired dataset, or a list of data.frames if length(file) > 1.

See Also

dataDWD, selectDWD

Examples

Run this code
# NOT RUN {
# see dataDWD

# }

Run the code above in your browser using DataLab