Hi, I have been trying to get the RSAGA multi.focal.function function to work in R. This is how I have been calling it: multi.focal.function(in.grids=filestack,out.grid.prefix="test_multi",path="z:/saga/stack", fun=returnfirstline,in.varnames=c("elev_v","fix_v"),radius=3,search.mode="square",mw.to.vector=FALSE,mw.na.rm=FALSE) where filestack is a vector containing the names of two grids: a DEM and another grid with integer values. The returnfirstline function prints (to the console) the arrays that multi.focal.function sends to returnfirstline. This is all very basic because for now Im just trying to get a feel for how multi.focal.function works with multiple grids before I try and write a more complex function to use with it. In any case, this is the problem that I am having with it: everything seems to work in that returnfirstline prints the rectangular windows to the console output, but the problem is that multi.focal.function seems to set the first row of the input grids to NA values. This is what the header and first portion of the first four rows of the ascii DEM look like: ncols 202 nrows 202 xllcorner -50010.3411746 yllcorner 426994.8486065 cellsize 24.7883519 NODATA_value -9999 455 455 456 456 457 457 456 455 456 ( ) 454 455 456 456 458 458 458 457 457 ( ) 454 455 456 457 458 458 459 458 457 ( ) 454 454 456 457 458 458 459 458 457 ( ) And this is the first matrix window, derived from the DEM, that multi.focal.function passes to returnfirstline: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] NA NA NA NA NA NA NA [2,] NA NA NA NA NA NA NA [3,] NA NA NA NA NA NA NA [4,] NA NA NA NA NA NA NA [5,] NA NA NA 454 455 456 456 [6,] NA NA NA 454 455 456 457 [7,] NA NA NA 454 454 456 457 As you can see, the centre value of the matrix window is NA, which really should be the elevation 455 from the first row of the DEM. Any idea why this is happening, or am I just not understanding how to use multi.focal.function? Thanks, Nathan Nathan Odgers Postdoctoral Fellowglobalsoilmap.net West Virginia University Division of Plant and Soil Sciences National Soil Survey Center Geospatial Research Unit ph: +1 304 293 9839
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo