graphab_project: Create a Graphab project

View source: R/graphab_project.R

graphab_projectR Documentation

Create a Graphab project

Description

The function creates a Graphab project from a raster file on which habitat patches can be delimited.

Usage

graphab_project(
  proj_name,
  raster,
  habitat,
  nomerge = FALSE,
  minarea = 0,
  nodata = NULL,
  maxsize = NULL,
  con8 = FALSE,
  alloc_ram = NULL,
  proj_path = 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 will be created.

raster

A character string indicating the name of the .tif raster file or of its path. If the path is not specified, the raster must be present in the current working directory. Raster cell values must be in INT2S encoding.

habitat

An integer or numeric value or vector indicating the code.s (cell value.s) of the habitat cells in the raster file.

nomerge

(optional, default=FALSE) A logical indicating whether contiguous patches corresponding to different pixel codes are merged (FALSE, default) or not merged (TRUE). Be careful, the nomerge = TRUE option is in development and we cannot guarantee the results are correct.

minarea

(optional, default=0) An integer or numeric value specifiying the minimum area in hectares for a habitat patch size to become a graph node.

nodata

(optional, default=NULL) An integer or numeric value specifying the code in the raster file associated with nodata value (often corresponding to peripheric cells)

maxsize

(optional, default=NULL) An integer or numeric value specifying the maximum side length of the rectangular full extent of each habitat patch in metric units. If this side length exceeds maxsize m, then several patches are created. (often corresponding to peripheric cells)

con8

(optional, default=FALSE) A logical indicating whether a neighborhood of 8 pixels (TRUE) is used for patch definition. By default, con8=4, corresponding to 4 pixel neighborhood.

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.

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().

Details

A habitat patch consists of the central pixel with its eight neighbors if they are of the same value (8-connexity) and the path geometry is not simplified. See more information in Graphab 2.8 manual: https://sourcesup.renater.fr/www/graphab/download/manual-2.8-en.pdf

Author(s)

P. Savary, T. Rudolph

Examples

## Not run: 
proj_name <- "grphb_ex"
raster <- "rast_ex.tif"
habitat <- 5
graphab_project(proj_name = proj_name,
               raster = raster,
               habitat = habitat)

## End(Not run)

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