dwd.download: Downloads data of the DWD

Description Usage Arguments Details Value Author(s)

View source: R/download.R

Description

It will guide the user through the hierarchical structure of the DWD's FTP server and let her choose some data. Then, the data will the downloaded, extracted locally, and converted into a format usable within R. This data, along with some meta-data obtained during the download as well, will be stored on the hard disk so the user load it later on using the source.data function.

Usage

1
2
3
4
5
dwd.download(save.downloads = TRUE, csv.export = FALSE, url = NULL,
  download.folder = NULL, batch.choices = NULL,
  time.series.format = c("xts", "data.frame"),
  use.geospatial.position.format = TRUE, quiet = FALSE,
  debug = FALSE)

Arguments

save.downloads

If TRUE, the downloaded .zip files are stored in download.folder/downloads_dwd. Else, they will be deleted after the extraction. Default = TRUE.

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.

url

A character vector containing one or more URLs pointing to the different data folders on the FTP server of the DWD. If this input argument is present, the interactive selection of the data set will be skip.

download.folder

Specifies where the data will be stored and downloaded to. If you wish to alter the default settings and provide a string using this input argument instead, it is advised to store it in the options( "dwd2r.download.path" ) too, because it will also be used to import the saved data. You can overwrite its default value of "~/R/dwd_data/" by adding options( dwd2r.download.path = "PATH" ) to the .Rprofile configuration file in your home.

batch.choices

Numerical vector containing the numbers, which correspond to the choices in the interactive mode. If NULL, the choices will be selected interactively. Default = NULL.

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.

debug

If TRUE is enables verbose messages of the individual downloads performed within download.content. Default = FALSE.

Details

Since there is A LOT of different data provided by the German weather service (DWD), it makes no sense to specify them all using input arguments to this function. Instead, the user will be guided interactively through the different data sources and specifies the data she want using the inputs at the prompt. If you prefer to run the function non-interactive, you can use the batch.choices argument and supply a vector of numbers corresponding to your choices. See the get.dwd.ftp.url function for details.

When downloading content for the first time, the function reproduces the directory tree on the FTP server of the DWD and puts the specified files in the corresponding subfolders. Whenever the function is invoked another time, it compares the content of the folders in the URLs with the one of the corresponding local folders. All deleted files will be removed, new files will be downloaded, and all the others will stay untouched, which saves a lot of time when updating your data base. See download.content for details.

Depending on the data format present in the downloaded files, more than one file will be stored 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. See conversion.climate for details.

Value

invisible( TRUE )

Author(s)

Philipp Mueller


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