Compute the difference between two maps

Description

Compute the difference between two maps.
If the map of the standard deviation is given, the difference is divided by the standard deviation.

Usage

1
mapdiff(mapin, mapref, mapsd = FALSE, outfile = FALSE)

Arguments

mapin

raster map

mapref

raster map 2 (the reference)

mapsd

raster map conaining the standard deviation values.
If mapsd=FALSE, the standard deviation is not taken into account while computing the difference. By default, mapsd = FALSE.

outfile

file where the difference map is saved. If outfile=FALSE, the map is not saved but only returned. By default, outfile = FALSE.

Details

If mapsd is defined :

diff = \frac{mapin - mapref}{mapsd}

else :

diff = mapin - mapref

Value

Returns the difference map

Author(s)

Romain Frelat and Bruno Gerard

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ndvidirectory=paste(system.file("extdata/VITO_Mzimba",
    package="ndvits"), "/", sep="")
region="Mzimba"
filein=timetoMap(ndvidirectory,region, 2004,1,1)
filein2=timetoMap(ndvidirectory,region, 2005,1,1)

#load the maps
map04=readpartGDAL(filein)
map05=readpartGDAL(filein2)

#computing the difference of the 2 maps
diff=mapdiff(map04, map05)

#plot the difference map :
savemap(diff)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.