[STATSGRASS] kriging ...

Roger Bivand Roger.Bivand at nhh.no
Mon Jan 17 16:56:37 EST 2005


On Mon, 17 Jan 2005, A Horacio Samaniego wrote:

> Thanks for all the good suggestions...
> 
> I sure will provide a summary of my experience to the list.
> 
> I also have to add that gstat has been my choice so far, however, since I 
> changed OS (to OSX) was never able to recompile gstat with grass support 
> and finally gave up on that...
> 
> the error was related to not finding some file...
> 
> It will be interesting to know if in  spite of that it is possible to 
> write grass raster maps through the gstat/R interface without compiling 
> the gstat program with grass support (perhaps this question denotes some 
> confusion about the different versions of the same programs.... I guess 
> that both are trully independents. I mean you dont need to install and 
> compile gstat if you installed the module in R using the 
> install.packages("gstat") command ;)
> 

You are right, you don't need the stand-alone gstat to run gstat in R.
The R gstat package works very well - an example of the kinds of code you 
could use is (this uses the utm.maas and maasmask datasets in the GRASS 
package):

library(GRASS)
G <- gmeta()
library(gstat)
bmd142 <- vgm(158232, "Exp", 361.6, 24803.4)
plot(variogram(Zn ~ 1, location = ~east +north, data = utm.maas),
  model = bmd142)
g.zinc <- gstat(formula=Zn~1, location=~east+north, data=utm.maas,
  model=bmd142)
res <- predict(g.zinc, newdata=data.frame(east=east(G), north=north(G)),
  mask=maasmask)
plot(G, res$var1.pred)
rast.put(G, "gstatdemo", res$var1.pred)
system("d.mon start=x0")
system("d.rast gstatdemo")

the key thing being giving predict.gstat() the newdata= from the GRASS 
raster window from the helper functions using the GRASS metadata retrieved 
by gmeta(). This is from a demo done in September 2003, there may be 
detail changes, but it does work.

Roger


> 
> 
> thank you all for this great forum!
> 
> 
> H
> 
> ******** GSTAT COMPILING ERROR ON OS X ************************** 
> horacio:/usr/src/gstat-2.4.3 root# make
> (cd src; make)
> gcc -o gstat block.o data.o direct.o fig.o fit.o getest.o gls.o glvars.o 
> gstat.o lex.o lm.o map2fig.o map2gd.o mapio.o maputils.o msim.o nsearch.o 
> ossfim.o palet.o parse.o plot.o polygon.o pqueue.o predict.o random.o 
> read.o reml.o report.o sample.o select.o sem.o sem_main.o sim.o stat.o 
> ui.o userio.o utils.o vario.o vario_fn.o vario_io.o writecmd.o xvalid.o 
> -L../lib  -lmeschach  -lncurses -L 
> /Applications/Grass/grass54.app/Contents/Resources/grass54//lib  -lz -lm
> ld: -L: directory name missing
> make[1]: *** [gstat] Error 1
> make: *** [src/gstat] Error 2
> *****************************************************************
> 
> Horacio Samaniego
> Department of Biology
> University of New Mexico
> Albuquerque, NM. 87131
> Phone:  (505) 277-3431
> Fax:    (505) 277-0304
> 
> (http://www.unm.edu/~horacio)
> 
> _______________________________________________
> statsgrass mailing list
> statsgrass at grass.itc.it
> http://grass.itc.it/mailman/listinfo/statsgrass
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no





More information about the grass-stats mailing list