spread() and spread2() are now faster: the per-iteration adj() call
has been replaced with surgical Rcpp helpers (adjPairsMatrix() for
spread(), adjPairsWithId() for spread2()) that compute neighbour
pairs and apply edge filtering in C++. Output is value-identical to the
previous implementation across a multi-seed verification battery (the
pixels/initialPixels columns of spread2()'s data.table are now
integer rather than numeric, but values are unchanged).
Measured speedups: spread2 ~1.4×, spread ~1.6–2.3× depending on
spreadProb and scenario.spread()'s no-flags branch (no id/returnIndices/circle/
relativeSpreadProb/neighProbs set, non-matrix path) also now goes
through adjPairsMatrix() so the inner loop no longer calls adj().spread() and spread2(): each runs a
parameter grid twice with the same seed and asserts bit-identical output.test-spread-snapshots.R): assert that
spread() / spread2() output matches RDS snapshots captured from the
pre-Rcpp baseline across 30 seeded scenarios (15 spread × 3 seeds and
16 spread2 × 3 seeds). Snapshots and the regeneration script live in
tests/testthat/_spread_snapshots/.rasterizeReduced(): improved speed (#103). Benchmark on a 2000×2000
raster with 200 codes: single-column ~5× (0.65 s → 0.13 s), multi-column
~3.7× (0.69 s → 0.18 s).neutralLandscapeMap() now uses a built-in generator
(type = "gaussian", the only supported type) that fills a padded grid
with i.i.d. normal noise and smooths it with a square mean kernel,
producing a roughly Gaussian random field. Use the new smooth argument
to control autocorrelation length.NLMR-backed type values ("nlm_mpd",
"nlm_gaussianfield", etc.) have been removed from
neutralLandscapeMap(), and the NLMR dependency has been dropped
entirely (removed from Suggests, Remotes, and
Additional_repositories). The built-in "gaussian" generator replaces
this functionality with no external dependency
(PredictiveEcology/SpaDES.core#334).reproducible:::isGridded now exported as .isGridded (#99);distanceFromEachPoint;spread for use with SpatRasters (#93);.pointDistance (#97);testthat > 3.2.3 (#98);rasterizeReduced();dqrng (#96; @rstub). if backwards compatibility is needed, set dqrng::dqRNGkind("Xoroshiro128+") before running spread to ensure numerical reproducibility with previous versions;randomPolygons() works with sf objects;crw to accommodate downstream dependency changes;reproducible (>= 2.0.9)splitRaster() tests that broke due to changes in reproducible::Filenames() (#91)quickPlotcrw to allow downstream packages that use matrix classes instead of sf or SpatVector classes for "agents"CircStats, dplyr, purrr, DBI, RColorBrewer, googledrive, snowterra from raster and sp. Some functionality is available for sf, but this will not be complete.splitRaster() uses ".tif" as the default raster file typeterra::plot directly, but in a few cases, quickPlot::Plot is used as it is much better (e.g., spread2(plot.it = TRUE))reproducible supports R >= 4.1);terra to Importsmagrittr, rgeos, rlang, Require, graphicsSuggests: withrquickPlot, fastmatch, raster, sp, sf, CircStatssnow to Suggests as it's used for parallel raster operations;tools to Suggests for file.ext()terraterra compatibility addedneutralLandscapeMap expanded to use more NLMR functionsneutralLandscapeMap, replaces the defunct gaussMap in creating a neutral landscape map using the midpoint displacement algorithm available in NLMR::nlm_mpd.This is a major SpaDES.tools update causing breaking changes due to multiple CRAN packages no longer available as of R version 4.2 released April 2022.
ffbase and ff and deprecated use of lowMemory argument in spread (ffbase was removed from CRAN April 2022).RandomFields which is no longer maintained. We had to drop support for random landscape generation via gaussMap(); but see the NLMR package for tools to create random neutral landscapes.mergeRaster() can deal with rasters with different origins extents (i.e., that were not produced using splitRaster())spread2 was unable to use maxSize when start was the output of a previous spread2 call to which maxSize had not been supplied. This has now been fixed.spread2() causing failures on R-develRequire moved to Suggests, because it's only used in examples.distanceFromEachPoint: cl argument can now accept a numeric scalar indicating how many cores to use with an mclapply internallydistanceFromEachPoint: minor speed improvementsspread3 has new arguments (sdDist, dispersalKernel)spread under most conditions, especially larger events, possibly up to 2x.splitRaster() can now specify file extension, instead of defaulting to .grddistanceFromEachPoint bugfixes under some cases (some values of toCells, angles would cause errors)spread with allowOverlap = TRUE would give wrong results. Fixed.raster changes.We have identified a non-trivial bug in spread when using allowOverlap = TRUE.
Until we can patch this bug, using this argument value will generate an error.
We are currently working on a fix, which may take some time.
bit; its reverse dependencies, ff and ffbase, moved to Suggestsspread sped up for allowOverlap = TRUEreturnIndices arg in spread, allowing for numeric. New option, 2 allows for the fastest return possible, only pixelIndicesanimation since it is used in the spread3 example.backports for R-oldrel supportprofvis and microbenchmark from Suggests: all benchmarking is removed from automated testsspread2 speed enhancementsanimation, fasterize, and sf to suggests (used in examples)spread2 now takes a numeric for allowOverlap, to allow for 1 more scenario of overlapping, namely, allow between event overlapping, and within event overlapping only if the overlap occurs in the same iteration, otherwise, do not allow overlap within event.spread3 for simulating e.g., insect spreadpointDistance is now exportedRandomFields moved to Suggests to prevent clashes with data.table multithreadingrandomPolygon now has area argument, instead of hectares (deprecated), and it now succeeds for more cases.mergeRaster now accepts a function passed by the user when mosaic is triggered (#55, @tati-micheletti)initiateAgents example fixed to work with newer raster package versions (@rhijmans)splitRaster defaults to in-memory rasters when no file path specified (#47, @ianmseddy).reproducible package.compiler package no longer used; is automatic in R >= 3.5gaussMap (#20, @ianmseddy).fastMask to reproducible packagefastCrop(): raster::crop is faster than velox::crop under many tests.fastMask(): moved to the reproducible package.spread2)dplyr and mgcv added to Suggests because they are used in tests.randomPolygon function for single random polygon.spread2 when asymmetry used.A new package, which takes all auxiliary modelling functions out of the SpaDES package:
?SpaDES.tools::SpaDES.tools for an overview of included functionality.