Generate a Landscape Using Hierarchical Curdling
A function to generate a multidimensional landscape with each cell assigned a value of zero or one based on a the successive assignment of habitat at different spatial scales.
HierarchicalCurdling(DimExtents, HierBoxes, HierProp)
An integer vector with the length of the desired output in each dimension.
A matrix of integer values describing the size of the assignment boxes in each dimension and at each spatial hierarchy. Each row of the matrix represents a different hierarchy. The columns within each row describes the extent of the allocation volume in each dimension. If
An integer vector containing the number of allocation volumes to retain at each hierarchical sweep. If
A vector of length
prod(DimExtents) and with a dimensional extent attribute set to
DimExtents. Each element contains a zero or a one depending on the outcome of the hierarcical allocation.
Joseph Chipperfield <email@example.com>
With, K. A. (1997) The application of neutral landscape models in conservation biology. Conservation Biology, 11, 1069-1080.
With, K. A. and King A. W. (1997) The use and misuse of neutral landscapes models in ecology. Oikos, 79, 219-229.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# Create a 512 x 512 landscape allocated on three hierarchical levels. On the # first hierarchical divsion the landscape is divded into 64 cells of 64 x 64 # units each. 48 of these 64 cells are randomly selected as habitable. Each # of selected cells in the first hierarchical division is split again into 64 # cells of 8 x 8 units each. 48 of these cells are randomly selected for # allocation in the final level. The final hierarchical allocation, divides # the remaining selected cells into 64 1 x 1 cells. 32 of these 64 cells are # randomly selected as habitable # Dimension of output landscape dims.in <- rep(512,2) # Number of cells to select at each hierarchical level props <- c(48,48,32) # Create matrix of allocation units at each hierarchical level hier.mat <- rep(NA, length(props) * length(dims.in)) dim(hier.mat) <- c(length(props), length(dims.in)) hier.mat[1,] <- c(64,64) # 64 x 64 allocation cells in first hierarchy hier.mat[2,] <- c(8,8) # 8 x 8 allocation cells in second hierarchy hier.mat[3,] <- c(1,1) # 1 x 1 allocation cells in third hierarchy # Run the hierarchical curdling output.map <- HierarchicalCurdling(dims.in, hier.mat, props) image(output.map, col = c("black", "white"))
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.