Hi,

I am using a Landsat ETM Scene imagery for calculating the Linear
Corregionalization Method in CoKriging.  (gstat).

Can you kindly debug my snippet (See enclosed). Really appreciate your help.


Thanking in advance.


> coKrige1 <- variogram(coKrige2)Error in model.frame.default(terms(formula), 
> as(data, "data.frame"), na.action = na.fail) :
  object is not a matrix


> coKrige.fit <- fit.lmc(coKrige1, coKrige2, vgm(1, "Gau", 350, 1), TRUE, 
> 1.0)Error in fit.lmc(coKrige1, coKrige2, vgm(1, "Gau", 350, 1), TRUE, 1) :
  gstatVariogram var1 not present


> coKrige.predict <- predict(coKrige.fit, rGrid)Error in UseMethod("predict") :
  no applicable method for 'predict' applied to an object of class
"c('variogramModel', 'data.frame')"




On Fri, Aug 21, 2015 at 3:33 PM, Rajabhushanam. C <rajche...@gmail.com>
wrote:

> Hi,
>
> I am using a Landsat ETM Scene imagery for calculating the Linear
> Corregionalization Method in CoKriging.  (gstat).
>
> Specifically, there is one raster band imagery and then using readGDAL and
> gstat function calls, I am making a gstat object that is input to the
> Variogram call. Now, while I use *fit.lmc()*, I get an error message 
> *"gstatVariogram
> var1 not present"*. I have done some preliminary findings, and there are
> no pertinent messages in this message board that have Raster as an input to
> cokriging.
>
> Really appreciate if anybody can point me some relevant code or pseudo
> code to perform cokriging with Landsat one band imagery.
>
> Thank You
> C. Rajabhushanam.
>
library(raster)
library(sp)
library(rgdal)
library(gstat)
library(rasterVis)
library(lattice)

#sink(file="/home/raj/evolution_research/Geocomputing/coKriging/bands345_run.log")

Image1 <-raster("/home/raj/evolution_research/Geocomputing/Samples_Band3/Sample1_Band3.tif", layer=1, values="TRUE")
Image1

r1 <- readGDAL("/home/raj/evolution_research/Geocomputing/Samples_Band3/Sample1_Band3.tif")
plot(r1)

rGrid <- as(r1, "SpatialPixelsDataFrame")
summary(rGrid)
  
new.data <- as(Image1, "SpatialPointsDataFrame")

coKrige <- gstat(formula=values~1, data=new.data)

coKrige2 <- gstat(g=coKrige, model=vgm(1, "Gau", 350, 1), fill.all=TRUE)
list(coKrige2)

coKrige1 <- variogram(coKrige2)

class(coKrige1) <- c("gstatVariogram", "data.frame")
coKrige1$np <- rep(15, nrow(coKrige1))
coKrige1

coKrige.fit <- fit.lmc(coKrige1, coKrige2, vgm(1, "Gau", 350, 1), TRUE, 1.0)
coKrige.fit
summary(coKrige.fit)

coKrige.predict <- predict(coKrige.fit, rGrid)
  
plot(coKrige1, model=coKrige.fit)
#plot(coKrige.predict)
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to