gridFastHike: Fast Hiking Method on a gridded domain

Description Usage Arguments Examples

View source: R/FHM.R

Description

This function runs the Fast Hiking Method on a gridded domain. Output arrival time is in hours.

Usage

1
gridFastHike(domain, seeds, spatial.res = 1, fun = "Tobler", verbose)

Arguments

domain

Grid (matrix) of chosen dimension with diffusivity values for every grid cell. Values above 1 will boost diffusivity, below 1 will inhibit it. Values of 0 should mark cells that block diffusion.

seeds

A (4 x n) array containing the x-coordinate, y-coordinate, incept time and hiking.speed parameters for each of the n seeds.

spatial.res

(Optional) Spatial resolution of the grid in metre. See example below.

fun

(Optional) Hiking function to use, See hiking.speed for details.

verbose

(Optional) Boolean to control verbose output.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Single process
grid <- matrix(1,10,10)
seed <- data.frame(row=5, col=5, incept=0)
fh <- gridFastHike(grid, seed, verbose=FALSE)
image(fh$arrival.time)

# Two processes with same incept time
seeds <- data.frame(row=c(7,2), col=c(7,2), incept=c(0,0))
fh2 <- gridFastHike(grid, seeds, verbose=FALSE)
par(mfrow=c(1,2))
image(fh2$process, main='process')
image(fh2$arrival.time, main='arrival time')

# Same as before but changing spatial.res parameter
fh3 <- gridFastHike(grid, seeds, spatial.res=10, verbose=FALSE)

# Same as before but with a barrier in middle
grid[5,2:9] <- 0
fh4 <- gridFastHike(grid, seeds, spatial.res=10, verbose=FALSE)
par(mfrow=c(1,2))
image(fh4$process, main='process')
image(fh4$arrival.time, main='arrival time')

# Same as before but with different speeds
seeds <- data.frame(row=c(7,2), col=c(7,2), incept=c(0,0), v0=c(2,5))
fh5 <- gridFastHike(grid, seeds, spatial.res=10, verbose=FALSE)
par(mfrow=c(1,2))
image(fh5$process, main='process')
image(fh5$arrival.time, main='arrival time')

f-silva-archaeo/fastmaRching documentation built on Sept. 6, 2019, 9:13 p.m.