gainLossMaps: Plot gain and loss maps

View source: R/gain_loss_maps.R

gainLossMapsR Documentation

Plot gain and loss maps

Description

Generate maps for overall gain or loss and maps showing each class transition

Usage

gainLossMaps(
  ras1 = NULL,
  ras2 = NULL,
  brks = c(0, 0.2, 0.4, 0.6, 0.8, 1),
  binNames = c("V. low", "Low", "Med.", "High", "V. high"),
  binCols = c("dodgerblue", "darkolivegreen2", "gold1", "orange", "red"),
  mapsToMake = "both",
  xLabel = "X",
  yLabel = "Y",
  outFolder = NULL,
  saveToRaster = FALSE,
  saveImages = FALSE
)

Arguments

ras1

rasterLayer. Full path to the baseline raster (earliest in time).

ras2

rasterLayer. Full path to the future raster.

brks

Numeric. An array of bin break points. Default gives 5 equally spaced bins between 0 and 1.

binNames

Character. An array of names assigned to the bins.

binCols

Character. An array of standard R colour names or hexadecimal colour values.

mapsToMake

Character. Make 'both' gain and loss maps, just 'gain' maps, or just 'loss' maps.

xLabel

Character. Label for the map X-coordinate axis.

outFolder

Character. Path to an output folder into which rasters will be written.

saveToRaster

Logical. Save rasters to files in the folder specified in outFolder? Default is FALSE.

saveImages

Logical. Save images of rasters in png format in the folder specified in outFolder? Default is FALSE.

yLabelCharacter.

Label for the map Y-coordinate axis.

Details

Overall gain plot shows areas which transitioned from a lesser class to the indicated final class.

Similarly, the overall loss map shows areas which transitions from a higher class to the indicated final class.

Individual maps are produced showing each class transition which had at least one raster cell make the indicated transition.

Note that the maximum number of transition plots grows quickly with the number of suitability bins or classes. The number of possible transitions is:

\loadmathjax \mjdeqn

k = \sum_i = 1^N - 1 N - iASCII representation

For the default number of bins, N = 5 and so k = 15. Naturally, if the function is called with mapsToMake = 'both', the maximum number of transition maps could be 2 * k.

Default values for brks, and a matching set of bin names (binNames) and colours (binCols) match those for BRECIplot, but can be changed to as desired.

If saveToFile = FALSE (the default) then plots are made on the standard graphics device. This allows for users to review/manually save plots as images. However, setting saveToFile suppresses plotting to the standard graphics device. File names are generated by prefixing the name with 'Gain_map_" or 'Loss_map' followed by a concatenation of the from bin name followed by the to bin name.

Finally, users should be aware that processing large raster files will have large impacts on processing time, and memory and disk storage requirements.


peterbat1/BRECI documentation built on Sept. 14, 2022, 5:44 a.m.