View source: R/BumpDisconnectCells.R
BumpDisconnectCells | R Documentation |
Given upper and lower surfaces (raster layers) of a three-dimensional (3D) model layer, this function incrementally decreases lower cell values until a minimum vertical overlap between adjacent model cells is satisfied.
BumpDisconnectCells(rs, min.overlap = 2, bump.by = 0.1, max.itr = 10000)
rs |
'Raster*'. Collection of two raster layers, the first and second layers represent the upper and lower surface of a 3D model layer. |
min.overlap |
'numeric' number. Minimum vertical overlap between horizontally adjacent model cells. |
bump.by |
'numeric' number. Amount to decrease a cell value by during each iteration of the algorithm. |
max.itr |
'integer' count. Maximum number of iterations. |
During each iteration of the algorithm:
(1) Cells are identified that violate the minimum vertical overlap between adjacent cells; that is,
the bottom of cell i is greater than or equal to the top of an adjacent cell j minus the
minimum overlap specified by the min.overlap
argument.
(2) For cells violating the minimum vertical overlap, lower raster layer (rs[[2]]
) values are
decreased by the value specified in the bump.by
argument.
An object of class 'RasterLayer' that can be added to
rs[[2]]
to ensure connectivity between model layer cells.
Cell values in the returned raster grid represent vertical adjustments.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
set.seed(0) r_top <- raster::raster(ncols = 10, nrows = 10) r_bot <- raster::raster(ncols = 10, nrows = 10) r_top[] <- rnorm(raster::ncell(r_top), mean = 12) r_bot[] <- rnorm(raster::ncell(r_bot), mean = 10) rs <- raster::stack(r_top, r_bot) r <- BumpDisconnectCells(rs, min.overlap = 0.1) raster::plot(r, col = GetColors(255, reverse = TRUE)) summary(r[]) r_bot_new <- r_bot + r
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.