Hello,
I have a simulation that runs reasonably well (albeit with warning messages*), but when I try to carry out multiple runs of it using the experiment function I get the following error message:
Error in .local(.Object, ...)
25. |
.local(.Object, ...) |
24. |
initialize(value, ...) |
23. |
initialize(value, ...) |
22. |
new("GDALReadOnlyDataset", filename, silent = silent, allowedDrivers = allowedDrivers, options = options) |
21. |
rgdal::GDAL.open(object@file@name, silent = TRUE) |
20. |
.readRasterLayerValues(x, row, nrows, col, ncols) |
19. |
.local(x, ...) |
18. |
getValuesBlock(x, row1, nrows = nr, col = col1, ncols = nc) |
17. |
getValuesBlock(x, row1, nrows = nr, col = col1, ncols = nc) |
16. |
.local(x, y, ...) |
15. |
crop(sim$vegMapInit, studyAreaTmp) |
14. |
crop(sim$vegMapInit, studyAreaTmp) at scfmCrop.R#69 |
13. |
Init(sim) at scfmCrop.R#37 |
12. |
get(moduleCall, envir = fnEnv)(sim, cur[["eventTime"]], cur[["eventType"]]) |
11. |
eval(expr, envir, enclos) |
10. |
eval(quotedFnCall) |
9. |
.runEvent(sim, cacheIt, debug, quotedFnCall = quotedFnCall, moduleCall, fnEnv, cur, notOlderThan) |
8. |
doEvent(sim, debug = debug, notOlderThan = notOlderThan) |
7. |
spades(sim_, replicate = ind, ...) |
6. |
spades(sim_, replicate = ind, ...) |
5. |
FUN(X[[i]], ...) |
4. |
(function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.vector(X) || is.object(X)) ... |
3. |
do.call(get(parFun), args) |
2. |
experiment(sim = mySim, replicates = 2, dirPrefix = "exp1", saveExperiment = FALSE, clearSimEnv = FALSE) |
1. |
experiment(sim = mySim, replicates = 2, dirPrefix = "exp1", saveExperiment = FALSE, clearSimEnv = FALSE) |
It appears that information within one of my raster objects ‘vegMapInit’ is not being accessed correctly during the crop function in one of my modules, when I use the experiment function.
sim$vegMap <- crop(sim$vegMapInit, studyAreaTmp)
If I ask for table(sim$vegMapInit[]) I get the following error message:
Error: cannot allocate vector of size 1.6 Gb
My understanding is that the crop function is managing to access and select only the information that is required from vegMapInit when the simulation is run independently, but somehow it is unable to do this when it is run through the experiment function, tries to select everything, and becomes overwhelmed. Could this be the case? Why would this be?
Thank you!