conversion.climate: Converts the downloaded files into a format usable within R

Description Usage Arguments Details Value Author(s)

View source: R/import.R

Description

It takes a list of strings pointing to the individual files downloaded from the DWD server, extracts their content, converts it into a format usable within R. In addition, it also extracts meta-information about the stations and stores all of it on the hard disk of the user.

Usage

1
2
3
4
conversion.climate(files.list, files.description.list,
  csv.export = FALSE, download.folder, prefix.file.name,
  time.series.format = c("xts", "data.frame"),
  use.geospatial.position.format = TRUE, quiet = FALSE)

Arguments

files.list

Named list of character vectors containing absolute paths pointing towards the .zip files downloaded from the DWD FTP server. The names correspond to recent, historical, and diverse.

files.description.list

Named list of the corresponding description files. One for each element in files.list.

csv.export

If TRUE, the function creates an additional folder containing .csv files with the individual station data. Using them, the data can be accessed outside of R too. Default = FALSE.

download.folder

In this folder two subfolders tmpRecent and tmpHistorical will be created and used to unpack and extract the .zip archives provided via files.list in. It does not have to be the same as the one containing the downloaded content. Both temporary subfolders will be removed later on.

prefix.file.name

String, which will be prepended to all saved files.

time.series.format

Format of the extracted time series. They can either be of type data.frame and contain two columns, "date" and "value", or a time series provided by the xts package. Default = "xts".

use.geospatial.position.format

If FALSE, the object containing the geospatial information of all stations will be of type data.frame and consist of the columns named longitude, latitude, altitude, and name. If TRUE, an object of class SpatialPointsDataFrame will be used instead and the altitude and name information can be accessed via the @data attribute. Default = TRUE.

quiet

Whether or not to display the output generated when downloading the content. Default = FALSE.

Details

Depending on the data format present in the downloaded files, this function will store more than one file on the hard disk of the user. In case of aggregated data, a separate file per column (climatological quantity) will be saved using the name of the quantity as filename. In all those files in .RData format, two objects will be contained: A named list (using the station names) of all the station data in the format specified by time.series.format and an object containing additional meta-information for all stations (their longitude, latitude, and altitude) in a format specified by use.geospatial.position.format.

Since this function is agnostic of the type of data set picked for download and extraction, a prefix to the file names must be provided using prefix.file.name. Else, the temperatures of, e.g., both the hourly and daily data will be saved in a file called dwd.temperatures and one overrides the other. Instead, it will be saved into dwd.[prefix.file.name].temperatures.

If the user requires an additional storing of all content in .csv files, they will be stored in [download.folder]/csv/[prefix.file.name] and a separate folder will be created for each climatological quantity.

Value

invisible( TRUE )

Author(s)

Philipp Mueller


theGreatWhiteShark/dwd2r documentation built on May 22, 2019, 2:26 p.m.