| cs_advanced | R Documentation |
Solve a single circuit with user-specified source and ground layers.
cs_advanced(
resistance,
source,
ground,
resistance_is = "resistances",
ground_is = "resistances",
use_unit_currents = FALSE,
use_direct_grounds = FALSE,
short_circuit = NULL,
source_ground_conflict = "keepall",
four_neighbors = FALSE,
avg_resistances = FALSE,
solver = "cg+amg",
output_dir = NULL,
verbose = FALSE
)
resistance |
A terra::SpatRaster or file path. The resistance (or conductance) surface. Higher values represent greater resistance to movement. |
source |
A terra::SpatRaster or file path. Source current strengths (amps per cell). Cells with value 0 or NA are not sources. |
ground |
A terra::SpatRaster or file path. Ground node values.
Interpretation depends on |
resistance_is |
Character. Whether the resistance surface represents
|
ground_is |
Character. Whether the ground raster values represent
|
use_unit_currents |
Logical. If |
use_direct_grounds |
Logical. If |
short_circuit |
Optional terra::SpatRaster or file path. Raster
identifying short-circuit regions (aka polygons). Cells sharing the same
positive integer value are treated as short-circuit regions with zero
resistance between them. Default |
source_ground_conflict |
Character. How to resolve cells that appear in
both the source and ground rasters: |
four_neighbors |
Logical. Use 4-neighbor (rook) connectivity instead of
8-neighbor (queen). Default |
avg_resistances |
Logical. When using 8-neighbor connectivity, compute
the resistance of diagonal connections as the average of the two cells
rather than their sum. Default |
solver |
Character. Solver to use: |
output_dir |
Optional character path. If provided, output files persist
there. Default |
verbose |
Logical. Print Circuitscape solver output. Default |
Unlike the other Circuitscape modes, advanced mode does not iterate over focal nodes. Instead, the user provides explicit source current and ground conductance rasters, and a single circuit is solved. This gives full control over the current injection pattern and is useful for modeling specific scenarios such as directional movement between a defined source area and destination.
A terra::SpatRaster with the following layers:
Current density at each cell.
Voltage at each cell. Voltage is analogous to movement probability and decreases with distance from sources.
McRae, B.H. (2006). Isolation by resistance. Evolution, 60(8), 1551–1561. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.0014-3820.2006.tb00500.x")}
Circuitscape.jl: https://docs.circuitscape.org/Circuitscape.jl/latest/
cs_pairwise(), cs_one_to_all(), cs_all_to_one(), cs_setup()
library(terra)
res <- rast(system.file("extdata/resistance.tif", package = "circuitscaper"))
origin <- rast(system.file("extdata/source.tif", package = "circuitscaper"))
dest <- rast(system.file("extdata/ground.tif", package = "circuitscaper"))
result <- cs_advanced(res, origin, dest, ground_is = "conductances")
plot(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.