[R-sig-Geo] Intermittent error using clusterR

2013-12-13 Thread Guillaume Drolet
Hi, I wrote a code which uses clusterR to run a function on multiple CPUs [see this thread showing part of the code, that has fixed based on Robert's help: http://r-sig-geo.2731867.n2.nabble.com/cluster-error-with-clusterR-and-calc-td7585148.html]. Intermittently, my code stops with this error

[R-sig-Geo] Error in .gd_SetProject(transient, crs(r))

2013-12-10 Thread Guillaume Drolet
Hello, This morning I updated RStudio to version 0.98.484, and Quantum GIS to version 2.0.1 (Dufour) using the standalone installer. After that, I tried to run some code in RStudio and I got the error message below when running the following command: > filename <- "test.tif" > try(writeRaster(ra

Re: [R-sig-Geo] clusterR: error when using a cluster object passed as an argument to function

2013-11-29 Thread Guillaume Drolet
For others who could have the same error, I finally found the problem with my functions: the cl object should not be passed as an argument to clusterR when beginCluster() has been called (as explained in the documentation, sorry I didn't read it carefully before posting). I removed the use of c

[R-sig-Geo] clusterR: error when using a cluster object passed as an argument to function

2013-11-28 Thread Guillaume Drolet
Hi, I have a function, say fun1, in which I create a SNOW cluster object using: beginCluster(nodes) cl <- getCluster() Then I export variables to the cores (nodes) and load some libraries: clusterExport(cl, c("tmpdir", "maxmemory", "chunksize")) clusterEvalQ(cl, c(library(raster), library(rg

Re: [R-sig-Geo] Extract cell numbers from raster based on condition

2013-11-23 Thread Guillaume Drolet
Hi Brian, To get cell numbers of raster NA values, use this: cellnb.na <- Which(is.na(ras), cells = TRUE) Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Extract-cell-numbers-from-raster-based-on-condition-tp7585169p7585174.html Sent from the R-sig-geo maili

Re: [R-sig-Geo] cluster error with clusterR and calc

2013-11-20 Thread Guillaume Drolet
Hi Robert, Thanks for your help. I thought that overlay didn't work with clusterR (see ?clusterR: ... For example, it works with calc but not with overlay.) Is there any way to export variables to the clusters when using clusterR, similar to when using clusterExport() with snow, or if it HAS to b

[R-sig-Geo] cluster error with clusterR and calc

2013-11-20 Thread Guillaume Drolet
Hi,I have the piece of code below which returns this error: Error in clusterR(s, fun1, filename = f) : cluster error# Piece of code# x, y, z are rasters# f is a filenamefun1 <- function(x) { calc(x, fun = function(x) {10 * (x[2] - x[3]) / ENV.LAPSERATE + x[1] })}s <- stack(x, y, z

Re: [R-sig-Geo] writeRaster and raster give same error after package update

2013-11-20 Thread Guillaume Drolet
Hi Robert, This morning I got the error below when I tried to install the latest version of raster: > install.packages("raster", repos = "http://R-Forge.project.org";) Installing package into ‘C:/Users/Utilisateur/Documents/R/win-library/3.0’ (as ‘lib’ is unspecified) source repository is unavai

Re: [R-sig-Geo] writeRaster and raster give same error after package update

2013-11-19 Thread Guillaume Drolet
Robert: thanks! That's a great news! Can't wait to install the fixed version and continue my work. Guillaume -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-raster-give-same-error-after-package-update-tp7585138p7585141.html Sent from the R-sig-geo mail

[R-sig-Geo] writeRaster and raster give same error after package update

2013-11-19 Thread Guillaume Drolet
Hi, I've been working on a set of functions for a bit more than a month. This morning I updated all my packages (but not R) and now, when I call: outfile <- "b4.sinks.sgrd" writeRaster(myraster, outfile, overwrite = TRUE, datatype = "FLT4S", NAflag = -) or infile <- "b4.sinks.sdat" r <-

Re: [R-sig-Geo] writeRaster to TIF changes raster maximum value

2013-09-17 Thread Guillaume Drolet
max) > >> > > >> > > >> > As shown in the output from writeRaster, the maximum value in the > output > >> > TIF file is now 254. I double-checked and > >> > there are pixels with value 255 in the cropped area of the original