[R-sig-Geo] focal.function() adds NA value to output
Ludwig Hilger
l.hilger at ku.de
Fri Dec 20 09:53:57 CET 2013
Hello everybody,
I have an .asc file containing only 0 and 1 and I am running
focal.function() from the RSAGA package to sum these values in a moving
window. Using a 5*5 window, the values I get in the output grid do not range
between 0 and 25 but between -99999 and 99974, so evidently, the NA values
(-99999 in my case) is added to every single window output. I can not find
any explanation for this.
Appreciating you help and time,
regards,
Ludwig
*SessionInfo:*
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
LC_TIME=German_Germany.1252
attached base packages:
[1] grDevices datasets splines graphics stats tcltk utils
methods base
other attached packages:
[1] lattice_0.20-23 outliers_0.14 gplots_2.12.1 rgdal_0.8-11
raster_2.1-49 sp_1.0-13 RSAGA_0.93-6 plyr_1.8
shapefiles_0.7 foreign_0.8-55 gstat_1.0-17 svSocket_0.9-55 TinnR_1.0-5
[14] R2HTML_2.2.1 Hmisc_3.12-2 Formula_1.1-1 survival_2.37-4
loaded via a namespace (and not attached):
[1] bitops_1.0-6 caTools_1.14 cluster_1.14.4 gdata_2.13.2
grid_3.0.2 gtools_3.1.0 intervals_0.14.0 KernSmooth_2.23-10
rpart_4.1-3 spacetime_1.0-9 svMisc_0.9-69
[12] tools_3.0.2 xts_0.9-7 zoo_1.7-10
*The input grid can be found here: *
http:///www.altmuehlnet.de/~hilger/Diff_not_sig_plus.asc
*Here is my code:*
library(RSAGA)
ws <- 5
focal.function(
in.grid = "Diff_not_sig_plus.asc",
path = getwd(),
fun = "sum",
radius = (ws-1)/2,
out.grid.prefix = paste("Diff_not_sig_plus_", ws, "mal", ws, sep = ""),
varnames = "counts",
is.pixel.radius = TRUE,
valid.range = c(-10000, 10000),
out.nodata.value = -99999,
no.data.values = c(-99999),
mw.to.vector = FALSE,
mw.na.rm = TRUE,
search.mode = "square",
digits = 1,
dec = ".",
quiet = TRUE)
-----
Dipl. Geogr. Ludwig Hilger
Wiss. MA
Lehrstuhl für Physische Geographie
Katholische Universität Eichstätt-Ingolstadt
Ostenstraße 18
85072 Eichstätt
Tel.: 08421-93-1180
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/focal-function-adds-NA-value-to-output-tp7585417.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list