I am trying to generate a topographic wetness index raster with the RSAGA package in R. The output I am able to generate does not make sense to me, as it has a large number of NA cells and I wonder if I am doing something wrong. I have put together a simple dummy example to illustrate what I mean.
Session info: I am running R 3.2.3 on Ubuntu 15.10. I have SAGA v2.2.0 installed, as well as RSAGA v0.94-5.
library(RSAGA) library(raster) library(maptools) #get DEM for Switzerland alt <- getData('alt', country='CHE') # write to SAGA format tempInfile <- 'saga_temp_twi_in' writeRaster(alt, filename=tempInfile, format='SAGA') outfile <- 'saga_temp_twi_out.sgrd' call <- rsaga.wetness.index(in.dem='saga_temp_twi_in.sgrd', out.wetness.index=outfile, env=rsaga.env(modules='/usr/lib/x86_64-linux-gnu/saga/')) #read resulting file back in res <- raster('saga_temp_twi_out.sdat') par(mfrow=c(1,2)) plot(alt) plot(res)