1
我有一個包含LAT,LON和溫度數據的三列數據集 我想生成一個基於24個數據記錄器數據點預測景觀溫度的柵格圖像。該數據集可以訪問這裏:DATA插值到柵格
這是我這一步嘗試:
#Lets try to interpolate the data onto a raster
library (raster)
library (gstat)
library (sp)
#Temp and XY data
temp<-read.csv ('test_temp.csv')
#create a blank raster to the extent of the system
r<- raster (nrows=300, ncols=100, xmn=-84.95, xmx=-84.936, ymn=45.7, ymx=45.74)
#build a prediction model temp ~ LAT*LON
loc<-temp [,c(3,5,6)]
loc<-na.omit (loc)
#TPS model
tps<-Tps(loc, loc$TemperatureC)
#gstat model
mod1<-gstat (data=temp, formula=TemperatureC ~ 1, locations=loc)
summary (mod1)
r2<-interpolate(r, model=tps)
Error in scale.default(x, xc, xs) :
length of 'center' must equal the number of columns of 'x'
r2<-interpolate(r, model=mod1)
Error in bbox(dataLst[[1]]$data) : object not a >= 2-column array
Ultimatley我想創造出一系列插值數據的柵格,顯示在一天的不同時間的溫度變化。任何想法如何做到這一點?