Hi Dave:

If you can provide some code examples that would be easier, but I can give
you a couple of hints.  First, use debugmode=TRUE when you are testing your
function -- this will save you a lot of headaches down the line.  R will
enter its debugmode inside of the rasterEngine function so you can track
what is happening.

The first issue is that clump only works on raster objects.  rasterEngine,
in its default mode, sends "chunks" of the image to your function formatted
as *arrays*, not raster objects.  When you did chunk_format to raster, it
did, indeed, send the chunk as a small, cropped raster so clump worked,
BUT: all *outputs* from rasterEngine (at present) MUST be coerced to an
array that has the same number of columns and rows as the input (in that
order).  I might mod this down the road to allow raster outputs, but for
now you'll need to make sure the output is of type array.  I suspect you
are trying to return the chunk from your function as a raster, which is why
it isn't working.

Again: debugmode=TRUE, and track your function down to just before your
return the output -- check the type of the to-be-returned object and
confirm it is an array with dim()[1:2] equal to the input raster.

Good luck!

--j


On Thu, Aug 7, 2014 at 12:02 PM, Dave Marvin <dmarvin@carnegiescience.edu>
wrote:

> Hi,
> I am able to set up functions and apply them to a raster dataset in
> parallel using the rasterEngine function of the spatial.tools package, but
> only if the function performs just a numerical operation on the raster.
> When I try to incorporate a function from the raster package, such as
> clump(), the rasterEngine fails and I get an error:
>
> > Error in (function (classes, fdef, mtable): unable to find an inherited
> method for function ‘clump’ for signature ‘"array"’
>
> If I change "chunk_format" to "raster" in the rasterEngine function, then i
> get an error:
>
> > chunk processing units require array vector outputs.  Please check your
> function.
>
> 1) Am I doing doing something wrong, or does this particular function just
> not work with rasterEngine?
>
> 2) If it is the latter, which of the raster package functions are available
> for use in parallel processing with rasterEngine?
>
> Thank you.
> -Dave
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@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@hotmail.com, Gchat: jgrn307, Skype: jgrn3007

	[[alternative HTML version deleted]]

