Learn R Programming

graph4lg (version 2.0.0)

graphab_capacity: 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,
  habitat,
  mode = "area",
  patch_codes = NULL,
  exp = NULL,
  ext_file = NULL,
  thr = NULL,
  linkset = NULL,
  codes = NULL,
  cost_conv = FALSE,
  weight = FALSE,
  proj_path = NULL,
  parallel.java = 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

habitat

A character string indicating the name of the habitat type whose patches will get a new capacity value. When the habitat type is defined from the source raster codes, all mode options are available. When it is of type 'vector', mode can only be `ext_file` or `neigh`. Only one habitat type can be treated at a time.

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 exponent.

  • 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 as a function of the neighboring raster cells of each habitat patch. The number of cells with a value given by the codes argument is summed up to the distance thr. This number can be weighted according to the weight argument.

patch_codes

(default=NULL) Deprecated parameter from verson 1.8.

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 of the considered habitat type. Its column names must include 'Id' and 'Capacity'. The 'Id' column must correspond to the patches' 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().

parallel.java

An integer indicating how many computer cores are used to run the .jar file. By default, parallel.java = NULL, and java sets it according to local settings.

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.

Author

P. Savary

Details

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

References

foltete2012softwaregraph4lg foltete2021graphabgraph4lg savary2024multiplegraph4lg

Examples

Run this code
if (FALSE) {
graphab_capacity(proj_name = "graphab_example",
                 mode = "area")
}

Run the code above in your browser using DataLab