[R-sig-Geo] Spatio Temporal kriging in Gstat

chris english englishchristophera at gmail.com
Tue Jun 21 07:24:05 CEST 2016


Daniel,

You get no complaints on creating st:

st=STSDF(sp,time,data,index,endTime=delta(time))

class(st) should show "STSDF".

It remains that x$np is pointing at nothing when you get to
sample.STvariogram.

I'd type:
>sample.STvariogram to try and work out what it is actually doing.

Then try debugonce(sample.STvariogram) to see what values are in my
environment.

It may be that index isn't doing what you hope, ie to indicate non-NA
values.

And as usual I could be wrong on all counts.

Chris
On Jun 21, 2016 4:12 AM, "Dan Turenne" <DanielTurenne at hotmail.com> wrote:

My apologies, I accidentally sent an unfinished email, here is the complete
version of my question


Hello R-Sig-Geo,


As part of my masters thesis I am attempting to use spatio-temporal
regression kriging to make predictions with temperature data, and I was
hoping that someone might be able to give some insight as to how the
algorithms work in gstat.  My data consists of daily temperature
observations from April 1 to July 31, 2000.  There are observations from
164 stations across these 122 days, however not all stations have
observations on all days, making for a total of 19282 records.


I have tried to use an STSDF object but I have not had any success.  I
created an sp object of length 164 with the station locations:


    sp = data.frame(long = stations$long, lat = stations$lat)

    coordinates(sp) = ~ long+lat


Then I created a vector of length 122 with the times the observations were
recorded and a data vector of length 19282:


    beginDate = as.Date(2000/04/01)

    endDate = as.Date(2000/07/31)

    times = as.POSIXct(seq(beginDate,endDate,by="days"))


    data=data.frame(temps$residual)


And I also made an index detailing where observations are available, it
looks like this with the first column representing spatial index and the
second representing the time index


    1   1

    2   1

    3   1

    4   1


    st=STSDF(sp,time,data,index,endTime=delta(time))


however when I try to calculate the sample variogram I get the following
error:


    sample.stVariogram=variogramST(residual~1,data=st, tunit="days",
tlags=1:7, progress=TRUE)



   Error in apply(do.call(cbind, lapply(ret, function(x) x$np)), 1, sum,  :
   dim(X) must have a positive length
   In addition: There were 50 or more warnings (use warnings() to see the
first 50)


All 50 of the errors are :


  In is.na(data[[as.character(as.list(formula)[[2]])]]) :
   is.na() applied to non-(list or vector) of type 'NULL'


Can anyone see what I am doing wrong or give me any pointers?  This error
is rather cryptic and I'm not quite sure what I'm doing wrong.  Any help
would be appreciated.


Many Thanks,

Daniel Turenne

University of Manitoba


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list