[R] Spatial Data Interpolation

Paul Hiemstra paul.hiemstra at knmi.nl
Mon Aug 1 11:33:48 CEST 2011


 Dear Peter,

The spatial taskview lists a number of interpolation methods [1]. Some
of those support spatio-temporal interpolation. For example gstat
supports spatio-temporal kriging [2,3,4].

regards,
Paul

[1] http://cran.r-project.org/web/views/Spatial.html
[2] http://en.wikipedia.org/wiki/Kriging
[3] http://www.google.nl/search?q=space+time+kriging
[4] http://cran.r-project.org/web/packages/gstat/index.html

On 07/30/2011 08:35 PM, Peter Maclean wrote:
> Dear GIS people
> What is the best way of implemeting spatial data interpolation (from large to small grids)-especially for dummies. I searched the internet and could not get concrete answer. Here is an example with simulated data.
>  
> #Example of spatial data interpolation
> require(utils)
> #I need to interpolate the temp and rain data (from its surounding points)
> #for the same period and accoubting for elevation
> #New coordinates and elevation
> lat  <-seq(-1, -5, by=-0.1)
> lon  <-seq(28, 30, by=0.1)
> year  <- seq(2000, 2005, by=1)
> period <- c("Mar", "Apr","May")
> ndata <- list(year=year,period=period,lat=lat, lon=lon)
> ndata <- expand.grid(ndata)
> ndata$elev <-sample(1000: 8000,nrow(ndata),replace=T)
> ndata <- ndata[order(ndata$year,ndata$period) , ]
> fix(ndata)
>  
> #Original data with elevation-same period
> lat   <- seq(-1, -5, by=-0.5)
> lon   <- seq(28, 30, by=0.5)
> data <- list(year=year,period=period,lat=lat, lon=lon)
> data <- expand.grid(data)
> data$temp <- sample(15:100, nrow(data),replace=T)
> data$rain <- sample(0: 1000,nrow(data),replace=T)
> data <- data[order(data$year,data$period) , ]
> data <- na.omit(merge(data,ndata, by=c("year", "period", "lat","lon")))
> fix(data)
> ##########
> #Spatial-Temporal Interpolation from original data (temp & rain) to new data
>
>
> Peter Maclean
> Department of Economics
> UDSM
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-help mailing list