2

我一直在尝试使用 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)
4

0 回答 0