dlGsodStations: Download (and extract) GSOD data

Description Usage Arguments Value Author(s) Examples

View source: R/dlGsodStations.R

Description

Download (and extract) data from a GSOD station based on its unique USAF code.

Usage

1
2
dlGsodStations(usaf, start_year = NA, end_year = NA, dsn = ".",
  unzip = FALSE, rm_gz = FALSE, ...)

Arguments

usaf

Numeric. A unique USAF station code. It can either be manually determined from data(gsodstations), or retreived from spatial subsetting (see stationFromCoords, stationFromExtent).

start_year

Numeric. The desired year to start data acquisition. If not supplied, download starts from the first year of measurement.

end_year

Numeric. The desired year to stop data acquisition. If not supplied, download stops at the last year of measurement.

dsn

Character, default is the current working directory. Destination folder for data download.

unzip

Logical, default is FALSE. If TRUE, *.gz files are unpacked and merged after download.

rm_gz

Logical, default is FALSE. If TRUE, *.gz files are removed after extraction. If unzip = FALSE, this argument is ignored.

...

Additional arguments passed to gzGsodStations.

Value

A vector of *.gz filenames, or an object of class data.frame if unzip = TRUE.

Author(s)

Florian Detsch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(dplyr)

data(gsodstations)
moshi <- filter(gsodstations, STATION.NAME == "MOSHI")

# Download data from Moshi, Tanzania, from 1990 to 1995
gsod_moshi <- dlGsodStations(usaf = moshi$USAF,
                             start_year = 1990, end_year = 1995,
                             dsn = paste0(getwd(), "/data/moshi/"),
                             unzip = TRUE)

# Plot temperature data (but: time series not continuous!)
plot(gsod_moshi$TEMP, type = "l")

environmentalinformatics-marburg/eimarGsodTools documentation built on May 13, 2017, 6:11 p.m.