fireBlockBurnGRASS: Block burn

Description Usage Arguments Details Value Author(s)

Description

Fire function for block burning

Usage

1
2
  fireBlockBurnGRASS(input, output, pathToGrassDB, year,
    doesBlockBurnFunction, overwrite = FALSE)

Arguments

input

name of the vector layer containing the polygons outlining the blocks

output

name of the output raster layer indicating cells which burned (==1) and which did not burn (==NULL)

pathToGrassDB

path to the sqlite grass db containing the attribute table of the layer

year

year of evaluation

doesBlockBurnFunction

R function determining if a certain block burns, taking the "fires" table in the as input

overwrite

if TRUE, the output layer will be overwritten if it exists

Details

This function simulates block burning, i.e. the burning of whole blocks. The blocks are defined by the polygons in the vector input layer and this function simly identifies blocks which are burning and adjusts the attributes table of input (see below for details) accordingly and returns a output raster layer containing 1 for cell burned and NULL for not burned.

The adjustments of the attributre table of the vector layer input are as follow:

  1. burns: This logical column is added if it does not exist yet or owerwritten. It contains logical values indicating if the corresponding block burns. The values will be overwritten each time the function is called.

  2. burns.YEAR: This logical column will be added if it does not exist or overwritten. YEAR is replaced by the argument year. The values are identical to the column burns but will not be overwritten if the function is called with a different year argument. Will be overwritten if the function is called with the same year argument.

  3. countFires: This integer column is added if it does not exist or it will be updated. It contains integer values indicating the number of times this block has burned. It will be updated each time the function is called.

  4. lastFire: This integer column is added if it does not exist or it will be updated. It contains the year when the last time the block has burned. If it has not burned yet, the value is NA. It will be updated each time the function is run.

To determine if a block burns, an R function is passed as the argument doesBlockBurnFunction. This function has to have the following form:

doesBlockBurnFunction <- function(fires){...}

where

fires

is a data.frame containing the attribute table of the input layer. This fires data.frame has the columns as mentioned above, although they might not contain any values if the function firesBlockBurn has not been called yet.

The function has to return a logical vector of the same length as the number of rows in the fires dataframe.

An example would be:

doesBlockBurn = function(fires) { return(as.logical(rbinom(n=nrow(fires), size=1, 0.5))) }

This function does not respects MASK in GRASS.

Value

invisible returns the updated attribute table of input as data.frame

Author(s)

Rainer M Krug <Rainer@krugs.de>


rkrug/fireSim documentation built on July 6, 2019, 4:37 p.m.