[R-sig-Geo] custom focal function on rasterstack
Jonathan Greenberg
jgrn at illinois.edu
Fri Mar 14 18:38:36 CET 2014
Ruben:
Give rasterEngine, within the spatial.tools package a whirl. Here's
the tutorial for it (some things are bit out of date, but this does
cover the focal analyses):
http://publish.illinois.edu/jgrn/software-and-datasets/rasterengine-tutorial/
Note there are examples of focal windows towards the end of the
tutorial. If you use a parallel engine (e.g. sfQuickInit() ) it will
run your process in parallel -- I've found a significant speedup using
focal windows in parallel mode.
--j
On Fri, Mar 14, 2014 at 10:10 AM, Ruben Van De Kerchove
<ruben.vandekerchove at gmail.com> wrote:
> Hi,
>
> I have rasterstack consisting out of 252 rasters (hyperspectral image) for
> which I want to calculate the mean distance to the centroid in a 3*3(*252)
> moving window. As the focal function (from the raster package) only works
> for rasters, I am currently using the getValuesBlock function (in a loop),
> but this seems rather slow. Therefore, I was wondering, if there is a more
> efficient way to tackle this problem.
>
> Best,
> Ruben
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> 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: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
More information about the R-sig-Geo
mailing list