Franz: I'm not sure what you mean that you can't use focal_hpc for your problem -- it seems like your problem would be fine for use with that function -- its a bit easier to use rasterEngine, by the way. You can use > 1 input raster into your functions if you are using rasterEngine, and you can pass non-raster parameters to the function as well. If you had a simple set of data to test, perhaps I can help you write the function.
As a heads up, focal window algorithms are slow, and get slower the larger the window size. rasterEngine/focal_hpc in spatial.tools will use parallel processing to speed it up, however. --j --j On Mon, Mar 3, 2014 at 4:27 PM, Franz Grassmann <[email protected]> wrote: > 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 > _______________________________________________ > R-sig-Geo mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: [email protected], Gchat: jgrn307, Skype: jgrn3007 _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
