[GRASSLIST:10737] krigging result looks weird
Carlos "Guâno" Grohmann
carlos.grohmann at gmail.com
Sat Mar 4 14:48:45 EST 2006
Hello again
I was playing with R, I get a SRTM (90m) raster, converted it to
vector, put it into R, calculate variogram and krigged a new map, with
30m resolution. The final maps looks "pixelate" (see attach)... Maybe
the parameters I used?
here's what I did:
1-r.to.vect (90m)
2-g.region res=30
R:
library(spgrass6) ; library(spatial);
srtm <- getSites6sp("toposrtm");
coords<-coordinates(srtm);
class(srtm);
G <- gmeta6();
grd <- GridTopology(cellcentre.offset=c(G$west+(G$ewres/2),
G$south+(G$nsres/2)), cellsize=c(G$ewres, G$nsres),
cells.dim=c(G$cols, G$rows));
mask_SG <- SpatialGridDataFrame(grd, data=list(k=rep(1,
G$cols*G$rows)), proj4string=CRS(G$proj4));
class(mask_SG);
trend <- surf.ls(1, x=coords[,1], y=coords[,2], z=srtm$cat);
resid1<-residuals(trend);
resid2<-as.data.frame(resid1);
resid.trend<-SpatialPointsDataFrame(coords,resid2);
resid.img <- SpatialGridDataFrame(grd, resid.trend);
library(gstat);
variog1 <- variogram(resid.trend$resid1 ~ 1, locations=resid.trend,
width=90, cutoff=1200);
plot(variog1);
vrg.eye<-(vgm(psill=7500, model="Gau", range=420, nugget=0));
plot(variog1, model=vrg.eye);
vrg.fit<-fit.variogram(variog1,vrg.eye);
vrg.fit;
model psill range
1 Nug 173.7465 0.0000
2 Gau 7661.1776 442.5015
plot(variog1, model=vrg.fit);
vrg.eye2<-(vgm(psill=7650, model="Gau", range=440, nugget=170));
plot(variog1, model=vrg.eye2);
OK_pred <- krige(srtm$cat ~ 1, loc=srtm, newdata=mask_SG,
model=vrg.eye2, maxdist=270);
names(OK_pred);
writeRast6sp(OK_pred, "srtm.krig", zcol="var1.pred", NODATA=-9999);
thanks again
--
+-----------------------------------------------------------+
Carlos Henrique Grohmann - Guano
Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kigging.jpg
Type: image/jpeg
Size: 34292 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20060304/09791306/kigging.jpg
More information about the grass-user
mailing list