STKriging export

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

STKriging export

Rodrigo Lilla Manzione
Dear list,

I am facing a doubt about what I am producing when performing STKriging.
Probably my mistake is when setting ST prediction frame.

I have groundwater monitoring time series from Sep 2014 to Sep 207 in a
semi-monthly observed frequency at 56 wells. I would like to have a
prediction in the end of the series and a forecast  about 100 days in
advance.

This is my code and data can be found at:
https://www.dropbox.com/sh/tz3lufzaup677aa/AAAC6CgkZ_XrIM2-8jvS1VbFa?dl=0

##############
library(gstat)
library(sp)
library(spacetime)

#data load#
#input data, space and time#
level <- read.table("water_level_up.csv", header=T)
s <- read.table("UTM_up.csv", header=T, row.names=1, sep=",")
d = read.table("dates_up.csv",sep=",", header=T)

#set time#
nr = nrow(d)
dates <- as.Date(d[1,1])
for (i in 2:nr){
dates[i]<- as.Date(d[i,1])
}

#set space#
stations <- SpatialPoints(s, proj4string=CRS(as.character(NA)), bbox = NULL)

#merge time, space and data#
water = STFDF(stations, dates, data.frame(level = as.vector(level)))


#GIS#
#load area mask#
mask = read.asciigrid("g_50.asc", as.image=F, plot.image=T)
image(mask, col="black")

#shows area and sample points#
spplot(mask, scales = list(draw=T), sp.layout=list("sp.points", stations,
pch="+"))


#ST modelling#
#empirical st-variogram#
empVgm <- variogramST(level~1, water, tlags=0:38,cutoff=2400)
plot(empVgm, wireframe=T,
scales=list(arrows=F),zlab=list(rot=90),zlim=c(0,3))

#covariance functions#
#product-sum model#
prodSumModel <- vgmST("productSum",
space = vgm(0.75, "Sph", 1250, 0.05),
time = vgm(1.45, "Sph", 120, 0.0),
k = 2)
psFit <- fit.StVariogram(empVgm, prodSumModel, fit.method = 7,
stAni = 117, method = "L-BFGS-B",
control = list(parscale=c(1,10,1,1,0.1,1,10)),
lower = rep(0.0001,7))

plot(empVgm, psFit)
plot(empVgm, psFit, wireframe=TRUE, all=TRUE)


#ST prediction#
#ST kriging#
#setting ST prediction frame#
t <- water[,"2017-09-04/2017-12-13"]
tt <- as.Date("2017-09-04")
tt[2] <- as.Date("2017-12-13")
pred <- STF(sp=as(mask,"SpatialPoints"), time=tt)

#Product-Sum model prediction#
predPS <- krigeST(level~1, as(t,'STSDF'), pred, psFit)
stplot(predPS)

#Data export#
#'*.csv'#
write.csv(predPS, "STkrigePS.csv")
############

When I plot the maps I have one map for Sep 13 and another on for Dec 13.
Perfect. When I export it, I have in the .cvs file two sequences of data,
one with time starting at Sep 04 and time ending at Dec13 and another one
starting at Dec 13 and ending at March 13.

My question is, whay am I exporting? Is these layers predictions for the
ending date based on the set up period variability? Or it is something
else? Of course I can have predictions for the date I choose setting the
rigth period if that is the case, but I would like to understand better
what I am missing when setting the ST prediction frame

Thanks in advance,

Rodrigo Manzione, PhD
Associate professor
UNESP/FCE-Tupã
Brazil

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Livre
de vírus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>.
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo