在hydroTSM软件包中使用hydrokrige函数克制一些降雨记录的问题

时间:2018-02-05 11:36:22

标签: r interpolation kriging hydrotsm

我一直在尝试使用hydrokrige功能(hydroTSM包)来插入降雨数据。对于某些数据,似乎工作正常,而我无法理解结果,我得到了一些记录。以下是两个可重现的例子,有或没有问题。关于我们如何对这个问题进行排序(正确获得样本2的结果)的任何帮助都将非常感激。

非常感谢

library(raster)
library(hydroTSM)
library(sp)
#Defining coordinate system
CatchmentCRS <- CRS("+proj=utm +zone=45 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0")
#Specifying the Rain station data
Station <- c('A','B','C','D','E','F','G','H','I','J','K','L')
E <- c(310837,318763,327604,322488,342071,335614,350525,397733,367804,383061,351609,348017)
N <- c(3054360,3033922,3076276,3063420,3052069,3061389,3070430,3018240,2996366,3036835,3024248,3000284)
StationDf <- data.frame(Station,E,N)

#Defining a rectangular catchment 
Rectangle1 = Polygon(cbind(c(302699,400595,400595,302699),c(3078295,3078295,2991776,2991776)))
Catchment1 = Polygons(list(Rectangle1), "s1")
Catchment = SpatialPolygons(list(Catchment1), 1:1)

#Rain data set examples 
RainDataDf <- data.frame(A=numeric(1),B=numeric(1),C=numeric(1),D=numeric(1),E=numeric(1),F=numeric(1),G=numeric(1),H=numeric(1),I=numeric(1),J=numeric(1),K=numeric(1),L=numeric(1))

#Sample record set 1: 
RainDataDf[1,] <- c(1529.05,1619.50,NA,2393.85,NA,1143.70,2223.15,397.10,1745.70,1353.55,2254.80,2287.60)
 #Creating named numeric vector
RainTs <- as.numeric(RainDataDf[1,])
names(RainTs) <- c('A','B','C','D','E','F','G','H','I','J','K','L')
#Interpolating rainfall using IDW/Kriging
rain <- hydrokrige(x.ts= RainTs, x.gis=StationDf, 
                   X="E" , Y="N", sname="Station", 
                   type= "cells",
                   formula=value ~ 1,
                   subcatchments= Catchment,
                   p4s= CatchmentCRS,
                   cell.size= 1000)

但是,下面会生成对我来说似乎不正确的结果(可以看到最小值和最大值没有太大差别。两个样本数据的IDW结果都很好(只有普通克里金结果有这个问题) )。

#Sample record set 2 
    RainDataDf[1,] <- c(1657.100,2212.450,2878.450,2670.450,1255.600,1329.300,2216.679,1246.750,2240.250,1996.800,3703.900,1948.800)
    #Creating named numeric vector
    RainTs <- as.numeric(RainDataDf[1,])
    names(RainTs) <- c('A','B','C','D','E','F','G','H','I','J','K','L')
    #Interpolating rainfall using IDW/Kriging
    rain <- hydrokrige(x.ts= RainTs, x.gis=StationDf, 
                       X="E" , Y="N", sname="Station", 
                       type= "cells",
                       formula=value ~ 1,
                       subcatchments= Catchment,
                       p4s= CatchmentCRS,
                       cell.size= 1000)

0 个答案:

没有答案