Hi,

Im trying to apply a gstat model that incorporates an external drift
variable to a raster, using the interpolate function of the raster
package. I seem to be having trouble making it use the values of the
raster layer as the covariate specified in the gstat formula. Any help
greatly appreciated.

 

David Stephens.

 

> z <- raster('C:/geodata/astrium_bathy/6Sec/mosaic_crop_CH_UTM30.img')

> z

class       : RasterLayer 

dimensions  : 2759, 5918, 16327762  (nrow, ncol, ncell)

resolution  : 100, 100  (x, y)

extent      : 266620.4, 858420.4, 5440120, 5716020  (xmin, xmax, ymin,
ymax)

coord. ref. : +proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m
+no_defs +towgs84=0,0,0 

values      : C:\geodata\astrium_bathy\6Sec\mosaic_crop_CH_UTM30.img 

min value   : -113.719 

max value   : 7.293 

 

> projection(z) <- projection(psa.utm30)

> CH.V1.M <- gstat(NULL,id=
"CH.V1",formula=V1~z,locations=psa.utm30,model=CH.V1.vgm$var_model,nmax=
100)

> CH.V1.int <- interpolate(z,CH.V1.M,xyOnly=F,na.rm=T,overwrite=T)

Error in model.frame.default(terms.f, newdata, na.action = na.action) : 

  object is not a matrix

In addition: Warning message:

'newdata' had 2497396 rows but variable(s) found have 1 rows 

 
This email and any attachments are intended for the name...{{dropped:13}}

