graphab_capacity: Computes custom capacities of patches in the Graphab project

View source: R/graphab_capacity.R

graphab_capacityR Documentation

Computes custom capacities of patches in the Graphab project

Description

The function computes custom capacities of patches in the Graphab project

Usage

graphab_capacity(
  proj_name,
  mode = "area",
  patch_codes = NULL,
  exp = NULL,
  ext_file = NULL,
  thr = NULL,
  linkset = NULL,
  codes = NULL,
  cost_conv = FALSE,
  weight = FALSE,
  proj_path = NULL,
  alloc_ram = NULL
)

Arguments

proj_name

A character string indicating the Graphab project name. The project name is also the name of the project directory in which the file proj_name.xml is. It can be created with graphab_project

mode

A character string indicating the way capacities are computed. It must be either:

  • mode='area'(default): The capacity of the patches is computed as the area of each habitat patch. The argument exp makes it possible to raise area to a power given by an exposant.

  • mode='ext_file': The capacity of the patches is given by an external .csv file. See argument ext_file below.

  • mode='neigh': The capacity is computed depending on the neighbouring raster cells from each habitat patch. The number of cells with a value given by codes argument is summed up to the distance thr. This number can be weighted according to the weight argument.

patch_codes

(optional, default=NULL) An integer value or vector specifying the codes corresponding to the habitat pixel whose corresponding patches are included to compute the capacity as the area of the habitat when mode='area'. Patches corresponding to other initial habitat codes are weighted by 0.

exp

An integer value specifying the power to which patch area are raised when mode='area'. When not specified, exp=1 by default.

ext_file

A character string specifying the name of the .csv file in which patch capacities are stored. It must be located either in the working directory or in the directory defined by proj_path. It must have as many rows as there are patches in the project and its column names must include 'Id' and 'Capacity'. The 'Id' column must correspond to the patch ID in the 'patches' layer (see get_graphab_metric). The 'Capacity' column must contain the corresponding patch capacities to assign each patch.

thr

(optional, default=NULL) An integer or numeric value indicating the maximum distance in cost distance units (except when cost_conv = TRUE) at which cells are considered for computing the capacity when mode='neigh'.

linkset

(optional, default=NULL) A character string indicating the name of the link set used to take distance into account when computing the capacity. Only used when mode='neigh'. Link sets can be created with graphab_link.

codes

An integer value or a vector of integer values specifying the codes of the raster cells taken into account when computing the capacity in the neighbourhood of the patches, when mode='neigh'.

cost_conv

FALSE (default) or TRUE. Logical indicating whether numeric thr values are converted from cost-distance into Euclidean distance using a log-log linear regression. See also convert_cd function. Only used when mode='neigh'.

weight

A logical indicating whether the cells are weighted by a weight decreasing with the distance from the patches (TRUE) or not (FALSE). The weights follow a negative exponential decline such that wi = exp(-alpha*di), where wi is the weight of cell i, di its distance from the patch and alpha a parameter determined such that wi = 0.05 when di = thr.

proj_path

(optional) A character string indicating the path to the directory that contains the project directory. It should be used when the project directory is not in the current working directory. Default is NULL. When 'proj_path = NULL', the project directory is equal to getwd().

alloc_ram

(optional, default = NULL) Integer or numeric value indicating RAM gigabytes allocated to the java process. Increasing this value can speed up the computations. Too large values may not be compatible with your machine settings.

Details

See more information in Graphab 2.8 manual: https://sourcesup.renater.fr/www/graphab/download/manual-2.8-en.pdf Be careful, when capacity has been changed. The last changes are taken into account for subsequent calculations in a project.

Author(s)

P. Savary

Examples

## Not run: 
graphab_capacity(proj_name = "grphb_ex",
                 mode = "area")

## End(Not run)

graph4lg documentation built on Feb. 16, 2023, 5:43 p.m.