Learn R Programming

gimms (version 1.2.2)

downloadGimms: Download GIMMS NDVI3g Data

Description

Download GIMMS NDVI3g data, optionally for a given period of time. NDVI3g.v1 (NetCDF, until end 2015) is available from the "poles" and "ecocast" servers, whereas NDVI3g.v0 (ENVI binary, until end 2013) is "ecocast" and "nasanex" exclusive.

Usage

# S4 method for dateORmissing,dateORmissing
downloadGimms(
  x,
  y,
  version = 1L,
  dsn = getwd(),
  overwrite = FALSE,
  quiet = TRUE,
  mode = "wb",
  cores = 1L,
  server = c("poles", "nasanex", "ecocast"),
  ...
)

# S4 method for numericORmissing,numericORmissing downloadGimms( x, y, version = 1L, dsn = getwd(), overwrite = FALSE, quiet = TRUE, mode = "wb", cores = 1L, server = c("poles", "nasanex", "ecocast"), ... )

# S4 method for character,ANY downloadGimms( x, dsn = getwd(), overwrite = FALSE, quiet = TRUE, mode = "wb", cores = 1L, ... )

# S4 method for missing,missing downloadGimms( version = 1L, dsn = getwd(), overwrite = FALSE, quiet = TRUE, mode = "wb", cores = 1L, server = c("poles", "nasanex", "ecocast"), ... )

Value

A character vector of local filepaths.

Arguments

x

Start time for data download as either Date object (e.g., as.Date("2000-01-01")) or numeric year (e.g., 2000). Alternatively, a character vector of online filepaths to download created from updateInventory. If missing, all files available online are being downloaded.

y

End time for data download as either Date object or numeric year. Ignored if 'x' is a character object or missing.

version

integer (or any other convertible class), defaults to 1L. Specifies desired GIMMS NDVI3g product version, see 'Details' in updateInventory. Ignored if 'x' is a character object.

dsn

character, defaults to the current working directory. Target folder for file download.

overwrite

logical, defaults to FALSE. If TRUE, identically named files in 'dsn' will be overwritten.

quiet

logical. If TRUE (default), console output is reduced.

mode

character. See download.file.

cores

integer, defaults to 1L. Number of cores used for parallel processing. Note that a fast internet connection is required in order for parallelization to take effect.

server

See updateInventory.

...

Further arguments passed to download.file, e.g. 'method'.

See Also

updateInventory, download.file.

Examples

Run this code
if (FALSE) {
tmp <- tempdir()

## 'Date' method
gimms_files_date <- downloadGimms(x = as.Date("2000-01-01"),
                                  y = as.Date("2000-12-31"),
                                  dsn = tmp)

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

## 'character' method (i.e., particular files)
ecocast <- system.file("extdata", "inventory_ecv1.rds", package = "gimms")
gimms_files_char <- readRDS(ecocast)
gimms_files_char <- downloadGimms(x = gimms_files_char[1:6],
                                  dsn = tmp)

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

Run the code above in your browser using DataLab