[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-geo
Subject:    [R-sig-Geo] Unable to set temporary directory when using raster in R
From:       "Wall, Wade A ERDC-RDE-CERL-IL CIV" <Wade.A.Wall () erdc ! dren ! mil>
Date:       2016-08-17 18:02:40
Message-ID: C1524BE4BF45454293B8DF38FB9B5ECA7A583E33 () MS-EX1VKS ! erdc ! dren ! mil
[Download RAW message or body]

Hi all,

I am trying to use parallel processing with raster::predict, but am running into some \
issues because of the size of the raster files. I have tried to set the temporary \
directory, but it seems to be ignored. The drive I am trying to write to is an \
external hard drive and I am using Windows 7

Here is the code I have been using:

ncores = 4
cl = parallel::makeCluster(ncores)
doParallel::registerDoParallel(cl,ncores)
rows=1:nrow(env)
split=sort(rows%%ncores)+1
outname="envOut"
prediction = foreach(i=unique(split), .packages = c("raster"), .combine=c) %dopar% {
    raster.options(tmpdir="I:/GIS/tmpdir") ## my attempt to set the temporary \
directory  rows_sub=rows[split==i]
    sub = raster::crop(env,raster::extent(env,min(rows_sub),max(rows_sub),1,ncol(env)))
  raster::predict(object=env, model = model1,
    filename=paste("I:/GIS/Projects/LISU/",outname,i,".tif",sep=""))
    gc()
}
stopCluster(cl)

When I run the script, R continues to write to C:/Users/Wade/AppData/Local/Temp/...

Any hints as to why this is happening?

Wade

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic