def_grid_pred2: Convert raster suitability to habitat suitability surface for...

View source: R/def_grid2.R

def_grid_pred2R Documentation

Convert raster suitability to habitat suitability surface for simulations

Description

Takes multiple spatial inputs (range shapefiles, enm rasters) and makes a grid for the genetic simulations

Usage

def_grid_pred2(
  pred = NULL,
  samps = NULL,
 
    raster.proj = "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
)

Arguments

pred

is a raster stack with layers of hab suitability (assumes [0-1] with larger numbers better suitability)

samps

locations of actual genetic samples. SpatialPoints object assumed in same proj as raster input

raster.proj

the proj.4 string to impose on the raster enm (if not already specified) (defaults albers)

Details

Takes a raster stack and converts into the internal habitat suitability matrix (rows are time and columns represent cell IDs). This object is returned along with rasters delineating the locations of genetic samples and sum of suitabilities for each cell through time. These are all returned from the function as a new 'landscape' object, which formst he main input into /codegetpophist2.cells.

Value

Returns a landscape object with the following components:

  • details Data frame with the spatial extent of the landscape grid

  • occupied Vector of population IDs for occupied cells in the landscape grid

  • empty Vector of population IDs for empty cells in the landscape grid

  • sampled Vector of population IDs for sampled populations in the landscape grid

  • hab_suit Matrix with species habitat suitability (ranging from zero to one) through time. Rows in the matrix correspond to discrete time units and columns correspond to cells in the landscape

  • sumrast Raster that stores the extent and resolution of the simulation landscape

  • samplocsrast Raster showing the locations of cells that correspond to sampled populations

  • samplocs Simple feature encoding spatial vector data related to the sampling populations and a data frame with metadata of the sampling populations (population id, number of individuals, type of spatial data and coordinates)

  • sampdf Data frame with the spatial location of the sampling populations in the landscape grid

  • NAmask A RasterBrick object used to mask cells that are unsuitable (e.g., covered by glaciers, out of the study region, in large lakes or oceans)

See Also

ashSetupLandscape, getpophist2.cells

Examples

library(holoSimCell)
rs <- raster::brick(system.file("extdata/rasters/ccsm_160kmExtent_maxent.tif", package = "holoSimCell"))
newrs <- newLandscapeDim(rs,0.45)
land <- def_grid_pred2(pred=newrs, samps=transSampLoc(pts, range.epsg=4326, raster.proj=crs(rs)@projargs), raster.proj=crs(rs)@projargs)


stranda/holoSimCell documentation built on Aug. 4, 2023, 1:12 p.m.