Converts the list returned by popmaps() into a named
terra::SpatRaster using the extent, resolution, and coordinate reference
system from the original input raster.
Arguments
- pop_raster_list
A list returned by
popmaps().- input_raster
The raster used to create
pop_raster_list. It may be aterra::SpatRaster, a legacyraster::RasterLayer, or a path readable byterra::rast().- layer_names
Optional character vector of layer names. By default, layers are named
hard_boundary,ancestry_probability,axis_1,axis_2, and so on.
Value
A terra::SpatRaster with one layer per popmaps() output matrix.
Examples
ex_raster <- raster::aggregate(hija_raster, fact = 240)
aps <- popmaps(
input_raster = ex_raster,
input_locs = hija_struc,
surface = "G",
empirical_pt_dist = 0,
num_sites = 5,
num_tested = 2,
popmod = -0.05,
threshold = 0,
ncore = 1
)
popmaps_rast(aps, ex_raster)
#> class : SpatRaster
#> size : 2, 3, 5 (nrow, ncol, nlyr)
#> resolution : 2, 2 (x, y)
#> extent : -112.0038, -106.0038, 36.00399, 40.00399 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> source(s) : memory
#> names : hard_boundary, ancest~bility, axis_1, axis_2, axis_3
#> min values : 1, 0.120562, 0.000028, 0.000222, 0.000143
#> max values : 3, 0.922, 0.029962, 0.13234, 0.187033