Learn R Programming

RGISTools (version 0.9.7)

genCompositions: Create image compositions from a time series of satellite images

Description

genCompositions combines a series of satellite images to create compositions.

Usage

genCompositions(rstack, n, fun, by.days = FALSE, ...)

Arguments

rstack

a RasterStack, where layer names contain the capturing date of an image in "YYYYJJJ" format.

n

number of images combined in the aggregation.

fun

the function used to create the composite, such as max, min, mean, ...

by.days

logical argument. If FALSE, n indicates the number of consucutive images being aggregated. If TRUE, the function aggregates the imagery within every n days. The aggregation requires at least one image avaiable.

...

arguments for nested functions:

  • AppRoot the path where the images will be saved in the GTiff format.

Value

a RasterStack with the time series of the composite images.

Details

The layer of the composite image takes its name from the first image used in the composition.

genCompositions reduces the number of images but improves the total quality of the time-series by removing cloulds and outliers. One widespread compositing technique is the maximum value composition (MVC). This technique allocates in each pixel of the composite the maximum value (fun = max) that the pixel reaches during a time period (n, by.days = TRUE).

Examples

Run this code
# NOT RUN {
# loading NDVI images of Navarre
data("ex.ndvi.navarre")
# Ploting the images: clouds are found
genPlotGIS(ex.ndvi.navarre)
# the first composite image is made with images 1, 2 and 3, 
# and the second composite image is made with images 4, 5 and 6
composite.NDVI.a <- genCompositions(rstack = ex.ndvi.navarre,
                                    n = 3,
                                    fun = max)
genPlotGIS(composite.NDVI.a)
# when by.days=TRUE, the first composite image is made with images 1, 2 and 3, 
# the second with image 4, and the third with images 5 and 6.
composite.NDVI.3a <- genCompositions(rstack = ex.ndvi.navarre,
                                     n = 3,
                                     by.days = TRUE,
                                     fun = max)
# Check that the clouds were removed
genPlotGIS(composite.NDVI.3a)
# }

Run the code above in your browser using DataLab