[R-sig-Geo] Trouble with universal kriging

dschneiderch Dominik.Schneider at colorado.edu
Fri Jun 21 22:03:48 CEST 2013


Thanks for the heads up on +proj. I had not noticed that difference.

I read chapter 8, twice now.  It is not clear to me what the error message
I'm getting means:
Error in gstat.formula.predict(d$formula, newdata, na.action = na.action,  : 
  NROW(locs) != NROW(X): this should not occur
In addition: Warning messages:
1: 'newdata' had 5742 rows but variable(s) found have 200 rows 
2: 'newdata' had 5742 rows but variable(s) found have 200 rows

I thought newdata was supposed to be the new grid on which to predict.

Here is code for working data.
snotel=runif(200,0,3)
recon=sample(snotel,200)
recon[1:50]=snotel[1:50] # i'm not sure how to introduce spatial correlation
in this random data.
x=runif(200,-112.25,-104.125)
y=runif(200,33,43.75)

m2=data.frame(x,y,snotel,recon)
coordinates(m2)=~x+y
projection(m2)='+proj=longlat +datum=NAD83'

swe.grid=expand.grid(x=seq(-112.25,-104.125,0.125),y=seq(33,43.75,0.125))
coordinates(swe.grid) <- ~ x+y
projection(swe.grid)='+proj=longlat +datum=NAD83'
gridded(swe.grid) <- TRUE


#SessionInfo()
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
base     

other attached packages:
[1] raster_2.1-25   maptools_0.8-23 lattice_0.20-13 foreign_0.8-52 
gstat_1.0-16   
[6] sp_1.0-8       

loaded via a namespace (and not attached):
[1] intervals_0.14.0 spacetime_1.0-4  tools_2.15.2     xts_0.9-3       
[5] zoo_1.7-9   




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Trouble-with-universal-kriging-tp7583848p7583875.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list