NvecNAs | R Documentation |
converts cells in Nvec form to NA if their underlying hab suit is NA for that time point
NvecNAs(ph, l)
ph |
pophist object |
l |
landscape containing the rasters |
returns a pophist object where the Nvecs matrix (population size through time) has been altered such that population size in glaciated cells is recorded as NA. All other components of the returned pophist object are unaltered from ph
. Useful for calculation of biotic velocity using enmSdm::bioticVelocity()
.
a pophist object where population size in unsuitable cells at each time point is recorded as NA
getpophist2.cells
, pophistToArray
, bioticVelocity
library(holoSimCell)
parms <- drawParms(control = system.file("extdata/ashpaper","Ash_priors.csv",package="holoSimCell"))
load(file=paste0(system.file(package="holoSimCell"),"/extdata/landscapes/",pollenPulls[[1]]$file))
refpops <- pollenPulls[[1]]$refs
avgCellsz <- mean(c(res(landscape$sumrast)))
ph = getpophist2.cells(h = landscape$details$ncells, xdim = landscape$details$x.dim, ydim = landscape$details$y.dim,
landscape=landscape,
refs=refpops,
refsz=parms$ref_Ne,
lambda=parms$lambda,
mix=parms$mix,
shortscale=parms$shortscale*avgCellsz,
shortshape=parms$shortshape,
longmean=parms$longmean*avgCellsz,
ysz=res(landscape$sumrast)[2],
xsz=res(landscape$sumrast)[1],
K = parms$Ne)
times_1k <- seq(-21000,0,by=990)
pharray <- pophistToArray(NvecNAs(ph, landscape), times = times_1G)
metrics <- c('centroid', 'nsQuants', 'summary')
BV_permill_all <- bioticVelocity(
x=pharray$pophistAsArray,
times = times_1G,
atTimes = times_1k,
longitude=pharray$longitude,
latitude=pharray$latitude,
metrics=metrics,
quants=c(0.05, 0.1, 0.9, 0.95),
onlyInSharedCells = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.