[R-sig-Geo] spacetime : the challenge of image time series containing holes

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Apr 13 00:52:19 CEST 2011


Servet,

For the solution below to work, you'll need spacetime package version
0.3-1, which I just submitted to CRAN (misnamed as
spacetime_0.3-2.tar.gz; I had to use passive ftp for some reason)

I added a solution to your problem that does not require the manual
create of an index to construct a sparse space time lattice (STSDF), as
was required in Tom's solution. Combined script below.

library(sp)
library(spacetime)
img200206 <- data.frame(rbind(
c(10849178, -4.979167,      -19.99302,      1.1542897E-03),
c(10849179, -4.979167,      -19.95120,      1.3418309E-03),
c(10849180, -4.979167,      -19.90937,      1.3988283E-03)))

img200207 <- data.frame(rbind(
c(10849178,  -4.979167,      -19.99302,      1.2843144E-03),
c(10849179,  -4.979167,      -19.95120,      1.1260216E-03)))

img200208 <- data.frame(rbind(
c(10849179,  -4.979167,      -19.95120,      1.5001300E-03),
c(10849180,  -4.979167,      -19.90937,      1.4793734E-03)))

coordinates(img200206)=c("X3","X2")
coordinates(img200207)=c("X3","X2")
coordinates(img200208)=c("X3","X2")

time = xts(1:3, as.POSIXct(c("2002-06-01","2002-07-01","2002-08-01")))

# solution one: spacetime creates index:
sp.list = list(img200206, img200207, img200208)
times = time[rep(1:length(sp.list), unlist(lapply(sp.list, length)))]
sp.all = do.call(rbind, sp.list)
stidf = STIDF(sp.all, times, sp.all at data)
stsdf = as(stidf, "STSDF")

# solution two: Tom creates index:
sp <- SpatialPoints(unique(rbind(coordinates(img200206),
coordinates(img200207), coordinates(img200208))))
data <- rbind(img200206, img200207, img200208)@data
index <- matrix(c(1:3, 1:2, 2:3, rep(1, 3), rep(2,2), rep(3,2)),
nrow=nrow(data))
mySTSDF = STSDF(sp, time, data, index)

# check they're equal:
all.equal(mySTSDF, stsdf, check.attributes)

On 04/12/2011 05:20 PM, scizmeli wrote:
> Hi Tom,
> 
> Thanks a million for your fast, accurate reply. I did not apply that to my
> imagery yet but the test I did show that it seems to work...
> 
> thank you!
> Servet
> 
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/spacetime-the-challenge-of-image-time-series-containing-holes-tp6255766p6265557.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
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.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list