[R-sig-Geo] Speeding up raster calculations

Franz Grassmann franz.grassmann at gmail.com
Mon Mar 3 23:27:28 CET 2014


Dear list members!

Maybe, someone has a good idea how to speed up my raster-calculation, or knows the right way how to deal with my „problem“.

For my master thesis, I use the focal-function and its focalWeight („raster“-package) for some raster calculations. For every cell of my map, I sum up the „resources“ of the surrounding cells by a certain weight that declines with distance (Its about foraging bees…). I got a map that holds the resources, and a certain focalWeight for every species of my model.

The command code looks similar to this:

result.raster <- focal(x = resource.map, 
                          fun = function(x) {sum(x)/sum(fW)},
                          w = fW)

It takes very long to create my raster, because the fW is quiet large for some species. I can’t use the focal_hpc()-command, because it doesn’t support the kind of focalWeight I use. For my analysis I also have to run this calculations for a number of species, seasons and scenarios.

My questions: Did I choose the right way to solve my tasks, or is there another, faster way for my calculations? I hope I didn’t choose the wrong package or program...
I am no programmer, but I am very interested in this topic an would welcome every tip on how to solve this, or hint where to read/learn more about this.

Best regards,
Franz Grassmann


More information about the R-sig-Geo mailing list