readDWD.meta: read dwd metadata (Beschreibung*.txt files)

View source: R/readDWD.R

readDWD.metaR Documentation

read dwd metadata (Beschreibung*.txt files)

Description

read dwd metadata (Beschreibung*.txt files). Intended to be called via readDWD().
Column widths for read.fwf() are computed internally.
if(any(meta)), readDWD() tries to set the locale to German (to handle Umlaute correctly). It is hence not recommended to call rdwd:::readDWD.meta directly on a file!
Names can later be changed to ascii with berryFunctions::convertUmlaut().

Usage

readDWD.meta(file, quiet = rdwdquiet(), ...)

Arguments

file

Name of file on harddrive, like e.g. DWDdata/daily_kl_recent_KL_Tageswerte_Beschreibung_Stationen.txt

quiet

Ignored. DEFAULT: FALSE through rdwdquiet()

...

Further arguments passed to read.fwf()

Value

data.frame

Author(s)

Berry Boessenkool, berry-b@gmx.de

See Also

readDWD()

Examples

## Not run:  # Excluded from CRAN checks, but run in localtests

link <- selectDWD(res="daily", var="kl", per="r", meta=TRUE)
link <- link[!grepl("mn4", link)] # for mn4 file May 2022
link <- grep(".txt$", link, value=TRUE)
if(length(link)!=1) stop("length of link should be 1, but is ", length(link),
                ":\n", berryFunctions::truncMessage(link,prefix="",sep="\n"))

file <- dataDWD(link, dir=locdir(), read=FALSE)
meta <- readDWD(file)
head(meta)

cnm <- colnames(meta)
if(length(cnm)!=8) stop("number of columns should be 8, but is ", length(cnm),
                        ":\n", toString(cnm))

## End(Not run)

rdwd documentation built on July 9, 2023, 5:24 p.m.