[R-sig-Geo] parallelize projectRaster()

Yerguner yasebaytok at gmail.com
Wed Jun 18 21:32:18 CEST 2014


Hi Jonathan,

Believe me I tried that and all other different combinations but starting
with the gdal_translate step only adds extra hrs to finish the whole
process. Actually, when I run the below gdalwarp commanline outside R, it
completes the same small netcdf file in ~ 2hrs but I just do the
reprojection and then do the resampling step in R in ~25 min. So, this was
the my first approach alternative to projectRaster() approach and 2,5 hrs is
better than 8 hrs. But again, unless there is a solution to speed up the
process (at least the reprojection part), both approaches do not work my
case. That's why I'm looking for way to do this all process in R to be able
to parallelize the functions as for the first approach. And I have also many
large files (each about the same size 5.5 GB) to repeat this process. So,
both the file sizes are large and many, in addition to doParallel(),
foreach() package might also be a solution?

gdalwarp and resample() approach:

gdalwarp -t_srs "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +no_defs
+a=6370997 +b=6370997 +to_meter=1.0" NETCDF:"colds1.nc":tmin colds1.tif     
## ~2 hrs

library(raster)
library(rgdal)
rasterOptions(tmpdir="some_tmp_path")
source_file1 <- "mod2000.tif"
source_file2 <- "colds1.tif"
mod00 <- raster(source_file1)
cold00s1 <- brick(source_file2)
submod00 <- crop(mod00,cold00s1)
rsmp1 <- resample(cold00s1,submod00,method="ngb")     ## 25 min
stackSelect
(rsmp1,submod00,filename="modcold00.tif",options="INTERLEAVE=BAND")

Thank you so much and looking forward to hearing from you,
Yasemin




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/parallelize-projectRaster-tp7586598p7586608.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list