getAreaStep: Calculate dBBMM and overlapping areas in steps

View source: R/get.R

getAreaStepR Documentation

Calculate dBBMM and overlapping areas in steps

Description

When a long study period is analysed the dBBMM can crash R since they are computationally heavy. You can use this function to calculate the dBBMMs and overlapping areas (between pairs of groups) according to a fixed step (i.e. timeframe in number of days), and export the output to disk as it goes. If your computer runs out of memory and kills R, you can then resume the calculations by setting a new output name (name.new) and specifying the previous one already stored in disk (name.file), and defining the new start date to resume the calculations (start.time). It currently only works with the 50

Usage

getAreaStep(
  input,
  base.raster,
  UTM,
  timeframe = 1,
  start.time = NULL,
  save = TRUE,
  name.new = NULL,
  name.file = NULL,
  groups = NULL
)

Arguments

input

The output of runRSP.

base.raster

The water raster of the study area. For example the output of shapeToRaster.

UTM

The UTM zone of the study area. Only relevant if a latlon-to-metric conversion is required.

timeframe

The intended temporal interval of interest (in number of days) to perform the calculations. Default is 1 day.

start.time

Character vector identifying the initial date (format = "Y-m-d") to start the calculations.

save

Logical (default is TRUE). Do you want to save the calculated areas to disk?

name.new

File name (character) to save calculations output to disk.

name.file

File name (character) of previous calculations output to be imported (if any).

groups

Vector of group names (character) of interest to perform calculations.

Value

A dataframe of dBBMM areas per group and the corresponding overlaps

Examples


# Import river shapefile
water <- actel::shapeToRaster(shape = paste0(system.file(package = "RSP"), "/River_latlon.shp"), 
size = 0.0001, buffer = 0.05) 

# Create a transition layer with 8 directions
tl <- actel::transitionLayer(x = water, directions = 8)

# Import example output from actel::explore() 
data(input.example) 

# Run RSP analysis
rsp.data <- runRSP(input = input.example, t.layer = tl, coord.x = "Longitude", coord.y = "Latitude")

# Calculate dBBMM and overlaps in steps:
df.areas <- getAreaStep(input = rsp.data, base.raster = water, UTM = 56, timeframe = 1, 
 name.new = "save.csv", groups = c("G1", "G2")) 



YuriNiella/RSP documentation built on Feb. 2, 2024, 5:03 a.m.