Skip to contents

This function calculates yearly tree cover maps based on a starting year layer in a binary forest mask form and an loss year layer which indicates which pixels were subject to forest loss in a given year,

Usage

getTM(inputForestMap, inputLossMap, years = 2000:2018)

Arguments

inputForestMap

A RasterLayer with a binary mask of forest cover (with 0 representing no forest; 1 representing forest) for the starting year.

inputLossMap

A RasterLayer in which the cell values represent the year in which forest loss occured during the time series represented in the years object.

years

A numeric vector indicating the years represented in the values of the inputLossMap object. 0 is expected to indicate no loss at all, a value of 1 corresponds to the first value in years, a value of 2 to the second, and so on.

Value

A binary RasterStack with a number of layers equal to length(years). A value of 0 represents no forest cover, a value of 1 represents forest cover. All cell values indicating forest loss in the inputLossMap object at a given year will be consectuivley set to 0. The result is a yearly binary classification of forest cover.

Author

Darius Görgen (MapTailor Geospatial Consulting GbR) info@maptailor.net
Maintainer: MAPME-Initiative contact@mapme-initiative.org
Contact Person: Dr. Johannes Schielein
Copyright: MAPME-Initiative
License: GPL-3

Examples

library(raster)
library(mapme.forest)

binaryCover = raster(system.file("extdata", "pkgTest_binaryCover.tif",
                                 package = "mapme.forest"))
lossYear = raster(system.file("extdata", "pkgTest_lossyear.tif",
                              package = "mapme.forest"))
yearlyMaps = getTM(inputForestMap = binaryCover,
                   inputLossMap = lossYear,
                   years = 2001:2018)
yearlyMaps
#> class      : RasterStack 
#> dimensions : 453, 643, 291279, 18  (nrow, ncol, ncell, nlayers)
#> resolution : 0.00025, 0.00025  (x, y)
#> extent     : 107.119, 107.2798, 16.58075, 16.694  (xmin, xmax, ymin, ymax)
#> crs        : +proj=longlat +datum=WGS84 +no_defs 
#> names      : y2001, y2002, y2003, y2004, y2005, y2006, y2007, y2008, y2009, y2010, y2011, y2012, y2013, y2014, y2015, ... 
#> min values :     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0, ... 
#> max values :     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,     1, ... 
#>