Learn R Programming

gimms (version 0.2.0)

rasterizeGimms: Rasterize GIMMS NDVI3g binary data

Description

Import GIMMS NDVI3g binary data into R as 'Raster*' objects based on a companion header file.

Usage

rasterizeGimms(x, header = NULL, water2na = TRUE, nodata2na = TRUE,
  scaling = TRUE, remove_header = FALSE, filename = "", ...)

Arguments

x
Character. Vector of local filepaths.
header
Character. Companion header files corresponding to the binary data in 'x'. If missing, the standard header file for GIMMS NDVI3g binary data as created by createHeader will be used.
water2na
Logical. If TRUE (default), pixels with 'mask-water' value (-10000) will be discarded. See also http://ecocast.arc.nasa.gov/data/pub/gimms/3g.v0/00READMEgeo.txt.
nodata2na
Logical. If TRUE (default), pixels with 'mask-nodata' value (-5000) will be discarded.
scaling
Logical. If TRUE (default), initial values will be scaled by a factor of 1/10000.
remove_header
Logical. If FALSE (default), the header file specified in 'header' or, if not specified, created internally via createHeader will be removed after all operations have finished.
filename
Character. Optional output filename, see writeRaster.
...
Further arguments passed on to writeRaster.

Value

  • If 'x' is a single filename, an object of class 'RasterLayer';
    if 'x' is a vector of filenames, an object of class 'RasterStack'.

See Also

createHeader, raster, writeRaster.

Examples

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

## Download GIMMS NDVI3g binary data from 2000-2005
gimms_files <- downloadGimms(x = 2000, y = 2005, dsn = gimms_dir)

## Rasterize downloaded GIMMS files from January and February 2000
gimms_raster <- rasterizeGimms(x = gimms_files[1:4], remove_header = TRUE)

plot(gimms_raster)

Run the code above in your browser using DataLab