Releases: PredictiveEcology/SpaDES.core
Releases · PredictiveEcology/SpaDES.core
v2.1.0
SpaDES.core 2.1.0
- fix issue with event queue
colnames
incompleted<-
andall.equal.simList
(#272); - fixed issue saving
simList
objects when multiple paths were used (e.g.,length(modulePath) > 1
); - events can be defined directly in calls to
newModule()
; - checkpoints are assumed to be used locally, and no longer invoke simulation file archiving and re-extraction of files (i.e., uses
saveSimList(..., inputs = FALSE, outputs = FALSE, cache = FALSE, files = FALSE)
); - improved recovery of interrupted simulations via
savedSimEnv()$.sim
--savedSimEnv()
is now exported for easier discovery -- an internal package environment is used, unless the user specifiesoptions(reproducible.memoisePersist = TRUE)
, which will use the global environment to store the.sim
object; - switch from
crayon
(superseded) tocli
for message colours;
Dependency changes
- require
reproducible
v2.1.0 or higher;
Breaking changes
- due to upstream changes in
reproducible
,loadSimList()
is incompatible withsimList
objects saved with earlier versions ofSpaDES.core
.
v2.0.5
v2.0.4
v2.0.3
SpaDES.core 2.0.3
Enhancements
- new accessor function
figurePath()
to get the directory of a module's output figures, which is now uses a separate subdirectory per module (i.e.,file.path(outputPath(sim), "figures", <moduleName>)
);Plots()
defaults to using this path, and module developers are encouraged to update their module code to usefigurePath(sim)
wherePlots()
is not being used. - re-Caching of a simList no longer triggers on changes to
.useCache
parameter, when it doesn't pertain to the event or module in question. - many historical modules used
bind_rows
fromdplyr
withinexpectsInput
orcreatesOutput
. Now, if a module usesbind_rows
and doesn't havedplyr
installed,SpaDES.core
will intercept and useSpaDES.core::bindrows
. saveSimList()
better handles relative paths and symbolic links (#263)saveSimList()
does an improved job at handling file-backed objects (previously, tests were passing because object was still there; now object is deleted, simList reloaded, and file-backed objects put back into place)- deal with upstream
reproducible
changes to.wrap
- deal with upstream
reproducible
changes toCache
messaging, specifically, remove cases wherefunction
was a userTag for an outer function call. Now these will display asotherFunction
, so that individual functions can be more easily isolated. - overhaul of messaging during
simInit
andspades
that allows for nested calls tosimInit
and/orspades
- elapsed time during
simInit
is now reported elapsedTime
now displays the largest time unit, which may not besecs
- some parts of any warning messages are now muffled for clarity: e.g.,
In modCall...
is removed. options
that are eitherRequireOptions()
,spadesOptions()
orreproducibleOptions()
can now be set during thesimInit
by passing them as arguments, e.g.,simInit(useMemoise = FALSE)
. See?simInit
, specifically the...
parameter description. This is not passed as an argument namedoptions
: these are just options. For convenience, user can omit the package prefix, e.g.,useMemoise
forreproducible.useMemoise
- all necessary updates to deal with
reproducible
updates to exported methods - new function:
dmin
to go with the otherd*
SpaDES times. - updates to unit tests to accommodate all these changes.
Dependency Changes
dplyr
is removed (again)
Bug fixes
coltab<-
fromterra
changed how it deals with multi-layerSpatRasters
. Two sample modules have been modified to set colours on these multi-layerSpatRasters
- loading of
asc
raster-type files usinginputs
did not work; fixed. - fixed bug in
simInit
parameter checking - A number of new edge cases dealt with for reducing false positive and false negative
Cache
ing of events and modules. Now, for example, a change to the parameter.useCache = c("init")
to.useCache = c("init", ".inputObjects")
will not trigger a rerun of theinit
event. Also,.inputObjects
is no longer evaluated forCache
ing ofdoEvent
Error in if (is.na(sim@params[[m]][[x]]))
fixed.asc
spatial map files were incorrectly loaded byterra
package: fixed.
SpaDES.core 2.0.2
Enhancements
- none
Dependency Changes
- none
Bug fixes
- new helpers for getting copies of sample files (
getSampleModules()
andgetMapPath()
) now used throughout examples, vignettes, and tests to avoid writing files in package installation directories.
v2.0.0
SpaDES.core 2.0.0
Enhancements
options(spades.futureEvents = TRUE)
has been reworked and now works under a wider array of conditions.Copy
,.wrap
,wrap
andunwrap
all have fairly robust methods forsimList
class. The generics are inreproducible
orterra
- updated
sampleModules
to usePlots
and.plot
parameter. - new function:
registerOutputs
can be used by a developer to add saved files to theoutputs(sim)
data.frame. - messaging during nested
simInit
orspades
calls will now not duplicate time prefix params
and.globals
were previously not expected to change duringCache
d events. Thus returned cached values were always the same as input asparams
and.globals
. They are now assessed and returned as part of theCache
, as expected.- updates to handle upstream changes in
Require
andreproducible
, including renamingcacheRepo
tocachePath
in some inherited functions. - updates to sample modules to use
SpaDES.tools::neutralLandscapeMap
instead ofNLMR
package directly - migration complete to use
terra
andsf
instead ofraster
,sp
,rgeos
, andrgdal
as defaults. Attempts have been made to maintain backwards compatibility in all cases. moduleMetadata
now handles multiple module paths- updates to
memoryUse
- new option: setting
options("spades.allowInitDuringSimInit" = TRUE)
, a user will haveinit
events of one ore more modules run during thesimInit
call, but only if they have no upstream dependencies, i.e., theirexpectsInputs
cannot be supplied by another module'screatesOutputs
.simInit
will determine which modules have no upstream dependencies and only these will be selected for running only theirinit
events. This can be useful e.g., if there is a module thatcreatesOutputs
for astudyArea
. .plots
arg inspades
can be set toNA
to turn of all plotting. This can also be set withoption(spades.plots = NA)
,- minor bugfixes
moduleMetadata
no longer runs.inputObjects
. In addition to being unnecessary and slow, it was also failing withreproducible (==1.2.16)
because it was trying to runCache
, which had a bug for this case. Now,moduleMetadata
no longer runs the.inputObjects
internally, so this bug is no longer relevant.- two new options --
spades.loadReqdPkgs
, so a user can turn off loading of packages, andspades.dotInputObjects
, so a user can omit running of the.inputObjects
function in modules duringsimInit
. These are updated inspadesOptions
. - some tests and examples have been shortened, to fit within the CRAN guidelines
- improved documentation
- new hidden function
runScheduleEventsOnly
will extract only thescheduleEvents
call; needed foroptions(spades.futureEvents = TRUE)
- new option:
spades.saveFileExtensions
which allows users to use theoutputs(sim)
mechanism for saving, for file extensions that are not already supported by.saveFileExtensions()
- many issues addressed and closed
Dependency Changes
- drop support for R 4.0 as dependency packages no longer support it;
- require
reproducible
v2.0.5 or higher; - require
quickPlot
v1.0.2 or higher; - removed
googledrive
from Suggests.
Bug Fixes
- several minor, e.g.,
Plots
when not specifyingfn
, butusePlot = FALSE
- many examples that were protected behind
\dontrun
or\donttest
were stale; these have been updated saveFiles
bugfix: multiple objects names can now be passed to.saveOuputs
module parameters.
Deprecated, Defunct, and Removed Features
- several previously-deprecated functions have been made defunct:
remoteFileSize()
,updateList()
. These will be removed by mid-2023.
v1.1.0
Known issues: https://github.com/PredictiveEcology/SpaDES.core/issues
version 1.1.0
new features
- messaging in a module can now handle "same line" messages --> simply use the standard
"\b"
in the message, and it will occur on same line as previous message Plots
now appends the filename any file saved duringPlots
to theoutputs
slot of thesim
, i.e., it will show up inoutputs(sim)
logPath
is now a function that points to a sub-folder offile.path(outputPath(sim), "log")
defineEvent
is a new function that allows a different way of specifying events than thedoEvent
function. This is not yet being used in the module templates, so does not appear withnewModule
.spades
can now run correctly, with "incomplete" modules that don't have metadata or even a module file. Now, a "module" will work withsimInit
andspades
if adoEvent.XXX
exists somewhere e.g., in the.GlobalEnv
.spades
will find it through inheritance and no longer complain if specific structures are absent. This may make it easier to learn how to useSpaDES
as it mimics a more normal user experience where functions are all in the.GlobalEnv
.- new option
spades.DTthreads
to limit the number of threads used bydata.table
(default 1).
Users can override this default if needed; modules cansetDTthreads()
as needed,
but should restore the original valueon.exit
. saveSimList()
andloadSimList()
accept.qs
or.rds
filesspades
andsimInit
now force UTF-8 encoding; this is reseton.exit
. If a module needs a different character encoding, then it can be set within the module code..studyAreaName
parameter added to default module metadata when usingnewModule
.- changes to template module documentation - removal of "module usage" as it is not relevant within a module, and minor restructuring
- new option
spades.scratchPath
, to be used for e.g., temporary raster files and temporary SpaDES recovery mode objects. - The default temporary
rasterTmpDir
has changed to be a subdirectory ofscratchPath
.
rasterPath
will be deprecated in a future release. - New default temporary
terraTmpDir
set as a subdirectory ofscratchPath
. - Old way of naming module functions with full module name plus "Init" ('non namespaced') no longer works. Message now converted to
stop
. - use
README.md
instead ofREADME.txt
in new modules.
dependency changes
- removed
RandomFields
dependency, as that package is no longer maintained; - added
NLMR
to Suggests to provide random landscape generation capabilities previously provided byRandomFields
.
bug fixes
memoryUse
was not correctly handling timezones; if the system call to get time stamps was in a different timezone compared to the internal SpaDES event queue, then the memory stamps were not correctly associated with the correct events.- improved handling of
data.table
objects usingloadSimList()
- Fixed caching of
.inputObjects
to correctly capture objects that were assigned tomod$xxx
. - Fixed caching of
simList
objects where changes to functions appeared to be undetected, and so a Cache call would return a stale module with function code from the CachedsimList
, which was incorrect. - fix recovery mode bug: use scratch directory specified by the user via
options(spades.scratchPath)
(see above). objSize
could have infinite recursion problem if there are simLists inside simLists. Fixed with newreproducible::objSize
, which useslobstr::obj_size
.- several minor fixes, including in
Plots
- fixes to
saveFiles
related todata.table
assignment and use inoutputs(sim)
v1.0.10
Known issues: https://github.com/PredictiveEcology/SpaDES.core/issues
version 1.0.10
new features
- experimental new feature
SpaDES
modules can now be R packages.
The simplest way to convert a module to a package is using the new functionconvertToPackage
.
Benefits of doing this are so that a SpaDES module can benefit from the infrastructure of an R package (e.g.,devtools::document
,devtools::check
, setting up Continuous Integration systems etc.).
Any documentation written using#'
i.e.,roxygen2
will be copied immediately above the function where it was sitting. newModule
now correctly places theSpaDES.core
package dependency in thereqdPkgs
element of the metadata, instead ofversion
. It will put the full Github reference if SpaDES.core was installed directly from GitHub.- There is a bug in
qs
package: eitherqsave
orqread
convertsdata.table
objects tolist
objects.loadSimList
has a work around internally to convert these objects back todata.table
, if the metadata indicate that the objects should bedata.table
objects. - new function:
paramCheckOtherMods
.
Can be used within a module to assert that a parameter has the same value as the same parameter in other modules.
This is therefore a check of a parameter that might be considered a.global
and passed withinsimInit(..., params = list(.globals = list(someParam = "someValue")))
, but the user did not do that. - now
spades
messaging when e.g.,debug = 1
can correctly accommodate nestedspades
calls, i.e., a SpaDES module callingspades
internally. newModule
now putsSpaDES.core
dependency in the correctreqdPkgs
instead ofversion
metadata element- to further the transition to using
.plots
instead of.plotInitialTime
,Plots
will check whether.plotInitialTime
is actually set in the module metadata first.
Only if it is there, will it evaluate its value. Currently, modules get default values for.plotInitialTime
even if the module developer didn't include it in the module metadata.
dependency changes
- drop support for R 3.6 (#178)
bug fixes
- minor bugfix when
debug
arg ofspades
is set to an event type that is also in the core modules (e.g., save, load), such as "init" Cache
-ing of asimList
, whenquick
is a character vector, errored. Now fixed.moduleMetadata
incorrectly droppeddefineModuleListItems
under certain signatures.
v1.0.9
Known issues: https://github.com/PredictiveEcology/SpaDES.core/issues
version 1.0.9
new features
moduleCoverage
has been rewritten to estimate code coverage of a module usingcovr
package.P
now has a replacement method. So, to update a parameter within a module (where it is namespaced, i.e., don't have to specify the module name):P(sim, "paramName") <- 1
. If using this outside a module, thenmodule
(3rd argument) will have to be specified.P
argument order changed to accommodate the fact that namespacing is used to detect module name: the user does not need to supplymodule
, so it should not be second. This is for the normalP
method and the new replace method above: it is nowP(sim, param, module)
; there are attempts to capture errors (i.e., parameter supplied that matches a module, but not a parameter; vice versa) and give a warning for user to change code. This may have little downstream effect as all known cases use theP(sim)$paramName
, which will still work fine, instead ofP(sim, "paramName")
.Plots
does a better job withRasterStack
objects plotted to screen withoutggplot2
- removed
.isFALSE
: usebase::isFALSE
now Plots
can now omit thedata
argument; just use the named arguments in ...defineParameter
now allows multi-linedesc
or multiple strings;paste
is no longer needed for longdesc
moduleCodeFiles
a new function that identifies all the code files in a collection of modules.globals
functionality is modified. If a user specifies a.globals
in the parameters object (passed intosimInit
), then all identical parameters in all modules will be overridden with these.global
valuesdefineParameter
,expectsInput
andcreatesOuptut
can all now have multi-linedesc
, without needing to usepaste
orpaste0
. Extraneous spaces and carriage returns will all be stripped. This can either be using a single multi-line quote or via multiple lines, each with its own""
.- the module environment in the
simList
is no longer "locked" withlockBinding
. It is already hidden insim$.mods
, and sincesim$.mods
can be modified, this was a weak caution against user modification. Further, formoduleCoverage
, the module environment needed to be unlocked, which is not allowed by CRAN.
dependencies
- no changes
bug fixes
- When
.inputObjects
was cached (via settinguseCache = '.inputObjects'
parameter), it was "too sensitive". Changes to any module's parameters, not just the current module, would cause rerun of.inputObjects
. Now it correctly identifies parameter changes only in the current module. THIS WILL CAUSE some existing caches to trigger a rerun once; after this, it will be less sensitive restartSpades
did not correctly deal with objects that did not yet exist prior to the event. Fixed with: 24b9cd1.restartSpades
was losing the previous completed events list. This has been fixed; it is now kept afterrestartSpades
- Plots - fixed issues with plot layer names and plot overlaying when passing
data
only (e.g.quickPlot::Plot
-like behaviour) simInitAndSpades
now has.plots
arg to matchspades
- fix raster file name query for GDAL 3.3.2 (#174; @rsbivand)
v1.0.8
Known issues: https://github.com/PredictiveEcology/SpaDES.core/issues
version 1.0.8
new features
Plots
function can be used likePlot
, but withtypes
specified.
The devices to save on disk will have some different behaviours to the screen representation, since "wiping" an individual plot on a device doesn't exist for a file device.
version 1.0.7
new features
Plots
function that will produce zero to 4 types of items that are relevant for plotting: 1) Visual on screen, 2) The plot object saved to disk, 3) The raw data that went into the plot and 4) The plot as one or more image files, e.g.,.png
or.pdf
viaggsave
spades
now accepts anevents
argument, which will limit the events that are run to those specified in the argument. This seems to be most useful for theinit
case, e.g.,spades(sim, events = "init")
. See?spades
.- messaging during
simInit
now is prefixed withSys.time()
and"simInit
" - messaging during
spades
is simplified to take up fewer characters:INFO::
has been removed simInit
now checks for minimum version ofSpaDES.core
needed in a module and stops if it fails, giving instructions how to upgrade.- several human-readable only elements of a module metadata are no longer enforced, including
spatialExtent
, as they are not used by the spades algorithms - new function:
anyPlotting
to test whether plotting of one form or another should occur - line-by-line messaging during
spades
call is now more informative, including module name (by default shortened -- can be changed withoptions("spades.messagingNumCharsModule"))
) defineParameter
can now accept a vector of "class", so a parameter can be more than one class.
Presumably this should generally not be used, but a good reason could be, say,c("numeric", "function")
, where the use can pass either a numeric or a function that would calculate that numeric.- new helper function
simFile
to generate file names for use with e.g.,saveSimList
zipSimList
is now exportedspades
will now attempt to loadreqdPkgs
, which is already done insimInit
.
In cases wheresimInit
was not run, e.g.,Cache(simInitAndSpades, ..., events = "init")
, then modules will not have access to packages.
For cases wheresimInit
was called, then this should add very little overhead.saveSimList
will now convert file-backedRaster*
class objects to memory iffileBackend = 0
.
Previously, it left them as is (on disk if on disk, in memory if in memory).- For code/documentation contributors, markdown syntax is now turned on and can be used when writing function documentation
- The first event will now run if it is scheduled to be prior to
time(sim)
in the case where it is equal to or afterend(sim)
. Previously, this would not run any events iftime(sim)
>=end(sim)
&&events(sim)[[1]] < time(sim)
. - minor documentation modifications
- Add optional
.seed
parameter for modules (#163)
Bugfixes
defineParameter
was throwingis.na(default)
warning when a parameter was not an atomic.- recovery mode did not work correctly if the file-backed rasters were in the temporary directory, as it would collide with the temporary directory of the recovery mode mechanism. Now recovery mode uses a dedicated temporary directory
- other minor bugfixes,