readDWD.stand {rdwd} | R Documentation |
read subdaily/standard_format dwd data
Description
read subdaily/standard_format dwd data.
Intended to be called via readDWD()
.
All other observational data at dwdbase
can be read
with readDWD.data()
, except for the multi_annual and
subdaily/standard_format data.
Usage
readDWD.stand(
file,
fast = TRUE,
fileEncoding = "latin1",
formIndex = formatIndex,
quiet = rdwdquiet(),
...
)
Arguments
file |
Name of file on harddrive, like e.g. DWDdata/subdaily_standard_format_kl_10381_00_akt.txt or DWDdata/subdaily_standard_format_kl_10381_bis_1999.txt.gz |
fast |
Logical: use |
fileEncoding |
|
formIndex |
Single object: Index used to select column widts and NA values.
To use a current / custom index, see the source code of
|
quiet |
Ignored.
DEFAULT: FALSE through |
... |
Further arguments passed to |
Value
data.frame with column names as per formatIndex
.
"Q"-columns have "_parameter" appended to their name. A "Date" column has been added.
NA-indicators have been processed into NAs.
Author(s)
Berry Boessenkool, berry-b@gmx.de, Oct 2019
See Also
Examples
## Not run: # Excluded from CRAN checks, but run in localtests
link <- selectDWD(res="subdaily", var="standard_format", per="r")
link <- link[grepl("10381", link, fixed=TRUE)]
# Not ID, according to meta data, hence no longer in column id (2023-04).
file <- dataDWD(link, dir=locdir(), read=FALSE)
sf <- readDWD(file)
sf2 <- readDWD(file, fast=FALSE) # 20 secs!
stopifnot(all.equal(sf, sf2))
plot(sf$Date, sf$SHK, type="l")
# Plot all columns:
if(FALSE){ # not run in any automated testing
tmp <- tempfile(fileext=".pdf")
char2fact <- function(x)
{
if(all(is.na(x))) return(rep(-9, len=length(x)))
if(!is.numeric(x)) as.factor(x) else x
}
pdf(tmp, width=9)
par(mfrow=c(2,1),mar=c(2,3,2,0.1), mgp=c(3,0.7,0), las=1)
for(i in 3:ncol(sf)-1) plot(sf$Date, char2fact(sf[,i]), type="l", main=colnames(sf)[i], ylab="")
dev.off()
berryFunctions::openFile(tmp)
}
## End(Not run)