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)
.
readDWD(file, meta = grepl(".txt$", file), fread = FALSE, minfo = FALSE,
format = NA, tz = "GMT", progbar = TRUE)
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"
Logical (vector): is the file
a meta file (Beschreibung.txt)?
DEFAULT: TRUE for each file ending in ".txt"
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
Logical: read the meta info txt files in the zip folder (instead of actual data)? Returns a named list of data.frames. DEFAULT: FALSE
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
Char (vector): time zone for as.POSIXct
.
"" is the current time zone, and "GMT" is UTC (Universal Time,
Coordinated). DEFAULT: "GMT"
Logical: present a progress bar with estimated remaining time? If missing and length(file)==1, progbar is internally set to FALSE. DEFAULT: TRUE
Invisible data.frame of the desired dataset, or a list of data.frames if length(file) > 1.