qualityControl: Perform Quality Control on GIMMS NDVI3g Data

qualityControlR Documentation

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 signature 'RasterStackBrick'
qualityControl(x, keep = NULL, filename = "", ...)

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.

Value

A quality-controlled 'RasterLayer' object.

See Also

rasterizeGimms, overlay.

Examples

## Not run: 
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)

## End(Not run)

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


gimms documentation built on Aug. 10, 2023, 1:07 a.m.