Learn R Programming

gimms (version 1.2.2)

qualityControl: Perform Quality Control on GIMMS NDVI3g Data

Description

Perform quality control on GIMMS NDVI3g data based on the companion flag information. This is merely a wrapper around overlay and, since quality control is readily available through rasterizeGimms, it is strongly recommended to use the latter function for this purpose.

Usage

# S4 method for RasterStackBrick
qualityControl(x, keep = NULL, filename = "", ...)

Value

A quality-controlled 'RasterLayer' object.

Arguments

x

A single 2-layered RasterStack object (NDVI and flags).

keep

integer. Accepted flag values (see 'Details').

filename

character. Optional output filename.

...

Further arguments passed to writeRaster.

Details

If 'keep' is missing, the function will automatically skip quality control and return the input object.

See Also

rasterizeGimms, overlay.

Examples

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

## Download NDVI3g.v1 sample data
ecocast <- system.file("extdata", "inventory_ecv1.rds", package = "gimms")
gimms_files <- downloadGimms(readRDS(ecocast)[1], dsn = tmp)

## Import data as 'Raster*' objects
ndvi <- raster::raster(gimms_files, varname = "ndvi")
ndvi[ndvi[] %in% c(-32768, -3000)] <- NA
ndvi <- ndvi / 1e4

flag <- floor(raster::raster(gimms_files, varname = "percentile") / 2e3)

## Perform quality control and visualize
to_check <- stack(ndvi[[1]], flag[[1]])
qcl <- qualityControl(to_check, keep = 0)

plot(qcl)
}

## see also 'Examples' section in ?rasterizeGimms for automated quality check

Run the code above in your browser using DataLab