createIndex {rdwd} | R Documentation |
Create file and meta index of the DWD CDC FTP Server
Description
This is mainly an internal function.
Create data.frames out of the vector index returned by indexFTP()
.
For fileIndex
(the first output element) createIndex
tries to obtain res, var, per, file, id, start and end from the paths.
If meta=TRUE
, metaIndex
and geoIndex
are also
created. They combine all Beschreibung files into a single data.frame.
If you create your own index as suggested in selectDWD (argument findex
),
you can read the produced file as shown in the example section.
Usage
createIndex(
paths,
base = dwdbase,
dir = "DWDdata",
fname = "fileIndex.txt",
meta = FALSE,
metadir = "meta",
mname = "metaIndex.txt",
gname = "geoIndex.txt",
overwrite = FALSE,
checkwarn = TRUE,
checklog = tempfile(),
quiet = rdwdquiet(),
...
)
Arguments
paths |
Char: vector of DWD paths returned by |
base |
Main directory of DWD ftp server, defaulting to observed climatic records.
DEFAULT: |
dir |
Char: writeable directory name where to save the main output(s).
Created if not existent. DEFAULT: "DWDdata" at current |
fname |
Char: Name of file in |
meta |
Logical: should metaIndex also be created from fileIndex?
Uses |
metadir |
Char: Directory (subfolder of |
mname |
Char: Name of file in |
gname |
Filename for |
overwrite |
Logical: Overwrite existing |
checkwarn |
Logical: warn about |
checklog |
Logfile for |
quiet |
Logical: Suppress messages about progress and filenames?
DEFAULT: FALSE through |
... |
Further arguments passed to |
Value
invisible data.frame (or if meta=TRUE, list with two data.frames) with a number of columns inferred from the paths. Each is also written to disc.
Author(s)
Berry Boessenkool, berry-b@gmx.de, Oct-Nov 2016, June 2017
See Also
indexFTP()
, updateIndexes()
, index
, selectDWD()
,
website index chapter
Examples
## Not run: # Not tested with R CMD check because of file writing
link <- "daily/kl/historical/tageswerte_KL_00699_19490101_19580630_hist.zip"
ind <- createIndex(link, dir=tempdir())
ind
# res var per id start end ismeta
# daily kl historical 699 1949-01-01 1958-06-30 FALSE
link2 <- "daily/kl/historical/KL_Tageswerte_Beschreibung_Stationen.txt"
link3 <- "daily/kl/recent/KL_Tageswerte_Beschreibung_Stationen.txt"
ind2 <- createIndex(c(link,link2,link3), dir=tempdir(), meta=TRUE, checkwarn=FALSE)
lapply(ind2, head)
link4 <- "1_minute/precipitation/meta_data/Meta_Daten_ein_min_rr_00755.zip"
ind <- createIndex(link4, dir=tempdir())
ind
## End(Not run)