[Gstat-info] Kriging results not smooth
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sun Mar 22 18:02:12 CET 2009
If you want more smooth output, try adding a nugget to your variogram.
As you're interpolating in long/lat, you should also worry about your
variogram model being not positive definite when using spherical
distance measures.
--
Edzer
Greg King wrote:
> Hi,
>
> I'm performing ordinary kriging on a fairly simple data set (attached in
> testOut.csv). My objective is to krig wind data from a 0.5x0.5 degree
> lat/lon grid to a higher resolution 0.125x0.125 lat/lon grid. I have the
> following code up and running to interpolate the u component ugrd_0:
>
> library(gstat)
>
> # Read u and v component wind data from a 0.5 x 0.5 degree resolution
> latitude/longitude grid
> wind<-read.csv(file="/Users/greg/temp/testOut.csv",head=TRUE,sep=",")
> coordinates(wind) <- ~ lat+lon
> proj4string(wind) <- CRS("+init=epsg:4326")
>
> # Prepare new 0.125 degree resolution grid
> lat.range <- as.integer(range(wind at coords[,1]))
> lon.range <- as.integer(range(wind at coords[,2]))
> grd <- expand.grid(lat=seq(from=lat.range[1], to=lat.range[2], by=0.125),
> lon=seq(from=lon.range[1], to=lon.range[2], by=0.125) )
> coordinates(grd) <- ~ lat+lon
> gridded(grd) <- TRUE
> proj4string(grd) <- CRS("+init=epsg:4326")
>
> # Create gstat object
> g <- gstat(id="ugrd_0", formula=ugrd_0 ~ 1, data=wind)
> # Create variogram model
> v.fit <- fit.variogram(variogram(g) ,vgm(model="Lin") )
> # Predict values
> p <- predict(g, model=v.fit, newdata=grd)
>
> # Visualise
> image(p, col=terrain.colors(20))
>
> However, the results it produces are not very smooth (see attached
> output.png), with the original data points being very apparent. Playing
> around with different models does not appear to make a difference. Are
> there any suggestions as to what I might be missing here?
>
> Thanks in advance,
>
> Greg
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Gstat-info mailing list
> Gstat-info at geo.uu.nl
> http://mailman.geo.uu.nl/mailman/listinfo/gstat-info
>
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de
More information about the Gstat-info
mailing list