Learn R Programming

gimms (version 0.3.0)

downloadGimms: Download GIMMS 3G data

Description

Download GIMMS 3G binary data for a given time span from NASA FTP server (http://ecocast.arc.nasa.gov/data/pub/gimms/3g.v0/).

Usage

## S3 method for class 'Date':
downloadGimms(x, y, dsn = getwd(), overwrite = FALSE,
  quiet = TRUE, mode = "wb", ...)

## S3 method for class 'numeric': downloadGimms(x, y, dsn = getwd(), overwrite = FALSE, quiet = TRUE, mode = "wb", ...)

## S3 method for class 'character': downloadGimms(x, dsn = getwd(), overwrite = FALSE, quiet = TRUE, mode = "wb", ...)

## S3 method for class 'missing': downloadGimms(dsn = getwd(), overwrite = FALSE, quiet = TRUE, mode = "wb", ...)

Arguments

x
If 'Date', start date for download (e.g. "2000-01-01"). If 'numeric', start year for download (e.g. 2000). If 'character', a vector of full online filepath(s) to download, typically returned from updateInvento
y
If 'Date', end date for download. If 'numeric', end year for download. If not supplied, download will stop with the latest file available.
dsn
'character'. Destination folder for file download. If not supplied, all downloaded files will be stored in the current working directory.
overwrite
Logical. If TRUE, already downloaded files in 'dsn' will be overwritten.
quiet
Logical. If TRUE, information sent to the console is reduced.
mode
...
Further arguments passed on to download.file, e.g. 'method'.

Value

  • A vector of filepaths.

See Also

download.file

Examples

Run this code
## Destination folder for data download
gimms_dir <- paste0(getwd(), "/data")

## 'Date' method
gimms_files_date <- downloadGimms(x = as.Date("2000-01-01"),
                                  y = as.Date("2000-06-30"),
                                  dsn = gimms_dir)

## 'numeric' method, i.e. full years
gimms_files_year <- downloadGimms(x = 2000, y = 2002, dsn = gimms_dir)

## 'character' method, i.e. file names
gimms_files <- updateInventory()
gimms_files <- gimms_files[grep("geo00", gimms_files)]
gimms_files_char <- downloadGimms(x = gimms_files, dsn = gimms_dir)

## 'missing' method, i.e. entire collection
gimms_files_full <- downloadGimms(dsn = gimms_dir)

Run the code above in your browser using DataLab