I am performing an interpolation in R but i get the following results. What could be the issue? The script
##MySript=group
##rainfall= vector
##output= output raster
require(sp)
require(rgdal)
rainfall
slotNames(rainfall)
rainfall@proj4string
rainfall@data
att.table = rainfall@data
class(att.table)
dim(att.table)
dimnames(att.table)
summary(rainfall)
plot(rainfall)
require(geoR)
require(sp)
require(maptools)
require(raster)
require(geoRglm)
require(rgeos)
require (rgdal)
locs=pred_grid(c(35.06,35.72), c(-1.63,-1.0), by = 0.002)
data1=as.geodata(rainfall)
plot(variog(data1, uvec=seq(0,1, by = 0.05)))
LE1=likfit(data1,cov.model="matern",ini=c(0.0002,0.06),
nugget =0.000002,kappa=1.5)
KC = krige.control(type = "sk", obj.mod = LE1)
sk1 = krige.conv(data1, krige = KC, loc = locs)
map=image(sk1)
The result
require(geoR)
Loading required package: geoR
--------------------------------------------------------------
Analysis of Geostatistical Data
For an Introduction to geoR go to http://www.leg.ufpr.br/geoR
geoR version 1.7-5.2 (built on 2016-05-02) is now loaded
--------------------------------------------------------------
require(sp)
require(maptools)
Loading required package: maptools
Checking rgeos availability: TRUE
require(raster)
require(geoRglm)
Loading required package: geoRglm
---------------------------------------------------------
A Package for Generalised Linear Spatial Models
geoRglm version 0.9-11 (2017-10-17) is now loaded
-----------------------------------------------------------
require(rgeos)
Loading required package: rgeos
rgeos version: 0.3-26, (SVN revision 560)
GEOS runtime version: 3.6.1-CAPI-1.10.1 r0
Linking to sp version: 1.2-7
Polygon checking: TRUE
require (rgdal)
locs=pred_grid(c(35.06,35.72), c(-1.63,-1.0), by = 0.002)
data1=as.geodata(rainfall)
plot(variog(data1, uvec=seq(0,1, by = 0.05)))
variog: computing omnidirectional variogram
LE1=likfit(data1,cov.model="matern",ini=c(0.0002,0.06),
nugget =0.000002,kappa=1.5)
---------------------------------------------------------------
likfit: likelihood maximisation using the function optim.
likfit: Use control() to pass additional
arguments for the maximisation function.
For further details see documentation for optim.
likfit: It is highly advisable to run this function several
times with different initial values for the parameters.
likfit: WARNING: This step can be time demanding!
---------------------------------------------------------------
likfit: end of numerical maximisation.
KC = krige.control(type = "sk", obj.mod = LE1)
sk1 = krige.conv(data1, krige = KC, loc = locs)
krige.conv: model with constant mean
krige.conv: Kriging performed using global neighbourhood
map=image(sk1)
writeRaster(output,"C:/PHDproposal/R_spatial/R_Spatial Exx/data/map.tif", overwrite=TRUE)
Error in writeRaster(output, "C:/PHDproposal/R_spatial/R_Spatial Exx/data/map.tif", :
object 'output' not found
Execution halted
##map= output raster? – aldo_tapia Aug 28 '18 at 17:01output. But you really should take the time to properly format your code if you're trying to get good help. – bwp8nt Aug 28 '18 at 17:02