[R-sig-Geo] space-time kriging

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Jul 1 15:27:16 CEST 2011


Pinar / Tom,

another route you might follow is (improvised):

require(spacetime)
prec_data$YearDate = as.Date(paste(prec_data$Year, "1", "1",sep="-"))
x = stConstruct(prec_data, c("X", "Y"), "YearDate")
class(x) # STIDF
x = as(x, "STSDF") # will sort out common locations & times

Bests,

On 07/01/2011 02:34 PM, Tom Gottfried wrote:
> You could try
> 
> index <- cbind(as.integer(as.factor(prec_data$Station)),
> as.integer(as.factor(prec_data$Year)))
> 
> Tom
> 
> 
> Am 01.07.2011 14:02, schrieb Pınar Aslantas Bostan:
>> Hi Edzer,
>>
>> Thank you for your mail.
>> Prec data has location and time information.
>>
>>> prec_data[1:10,]
>>     Station      X       Y   Prec Year Month Day
>> 1    17020 693894 4931348 1274.4 1970     1   1
>> 2    17020 693894 4931348 1134.3 1971     1   1
>> 3    17020 693894 4931348  940.7 1972     1   1
>> 4    17020 693894 4931348 1253.3 1973     1   1
>> 5    17020 693894 4931348  940.8 1974     1   1
>> 6    17020 693894 4931348  913.4 1975     1   1
>> 7    17020 693894 4931348  895.3 1976     1   1
>> 8    17020 693894 4931348  803.5 1977     1   1
>> 9    17020 693894 4931348  993.1 1978     1   1
>> 10   17020 693894 4931348  976.4 1979     1   1
>>
>>
>> -----Original Message-----
>> From: r-sig-geo-bounces at r-project.org
>> [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Edzer Pebesma
>> Sent: Friday, July 01, 2011 2:50 PM
>> To: r-sig-geo at r-project.org
>> Subject: Re: [R-sig-Geo] space-time kriging
>>
>> Hi Pinar,
>>
>> as you say, some data are missing, but the way you create index suggests
>> none are missing. Does your table "prec" have information for each
>> observation on which location and at which time it has been taken? Could
>> you maybe show how prec[1:10,] looks like?
>>
>> Wbr,
>>
>> On 07/01/2011 01:12 PM, Pınar Aslantas Bostan wrote:
>>> Dear all,
>>>
>>>
>>>
>>> I am working about space-time (ST) kriging. I want to make ST ordinary
>>> kriging with sparse data set. Dependent data is annual precipitation
>>> measured from 257 meteorological station. Observation period starts from
>>> 1970 and finishes at 2008, so temporal entity of my study contains 39
>>> year-value. Precipitation data comprised from 5365 value. It is not
>>> equal to
>>> 257 (location) *39 (time), because some stations has no value for some
>>> years. Therefore my data set fits to STSDF. An index table is
>>> required for
>>> STSDF object. But I could not create correct index object, my code
>>> does not
>>> work.
>>>
>>>
>>>
>>> I tried to summarize my code:
>>>
>>>
>>>
>>> # creating STSDF object
>>>
>>>
>>>
>>> # sp is spatial entity (257 spatial location)
>>>
>>> # time is temporal entity (39 year period)
>>>
>>> # prec is data attribute (5365 number of annual precipitation value)
>>>
>>>
>>>
>>> index<- as.matrix(expand.grid(1:length(sp),1:nrow(time)))
>>>
>>> w= STSDF(sp, time, data.frame(values = as.vector(t(prec))),index)
>>>
>>>
>>>
>>> Error: nrow(object at index) == nrow(object at data) is not TRUE
>>>
>>>
>>>
>>> Can you please help me about this error, how can I create correct index
>>> object?
>>>
>>>
>>>
>>> Thank you all in advance!
>>>
>>> With my best regards,
>>>
>>> Pinar
>>>
>>>
>>>
>>>
>>>
>>> Pinar Aslantas Bostan
>>>
>>> Research Assistant
>>>
>>> Department of Geodetic and
>>>
>>> Geographic Information Technologies (GGIT) Middle East Technical
>>> University
>>>
>>> 06531 Ankara/TURKEY
>>>
>>> aslantas at metu.edu.tr
>>>
>>>
>>>
>>>
>>>     [[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
>>
> 

-- 
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