How to solve error kriging with external drift in R?

229 Views Asked by At

I am trying to use kriging with external drift using hydrostm and hydrokrige. While, trying to interpolate, I can not interpolate well. I am using dem 30 m data. The code is following below:

library(zoo)
library(hydroTSM)
library(xts)
library(sp)
library(automap)
library(gstat)
library(sp)
library(rgdal)
library(raster)
bena.ts<- read.csv("EbroPPtsDaily.csv")
bena.gis = read.csv("EbroPPgis.csv")
bena.rs <- raster("DEM-UTM.tif")
bena.sa = readOGR("subBASIN-UTM.shp")
# Covert Raster to spatial grid data frame 
y <- as(bena.rs, "SpatialGridDataFrame")
class(y)
# Make Projection according to study area
p4s <- CRS("+proj=utm +zone=43 +datum=WGS84 +units=m +no_defs +ellps=WGS84
+towgs84=0,0,0")
bena.ts1 <- as.numeric(bena.ts[180, 2:ncol(bena.ts)])
names(bena.ts1) = colnames(bena.ts[180,2:ncol(bena.ts)])
# Computing OK, over the spatial grid defined by the DEM
## Not run: 
x.ok <- hydrokrige(x.ts= bena.ts1, x.gis=bena.gis, 
                   X="EAST_ED50", Y="NORTH_ED50", sname="ID", 
                   formula=value~1,
                   subcatchments= bena.sa,
                   p4s= p4s, 
                   predictors=y,
                   ColorRamp= "Precipitation", 
                   main= "OK Precipitation on the Ebro",
                   arrow.plot= TRUE, 
                   arrow.offset= c(900000,4750000), arrow.scale= 20000,
                   scalebar.plot= TRUE, 
                   sb.offset= c(400000,4480000), sb.scale= 100000)
1

There are 1 best solutions below

0
Muhammad Usman Liaqat On

bena.ts show daily precipitation values at different stationsbena.gis shows coordinates in UTM, elevation of points and subbasins namebena.sa tells about shapefile of study area in UTMbena.rs show DEM 30 m raster file

My issue is I can to interpolate it using elevation. I also conver my raster DEM 30 m file into spatial grid dataframe but still it do not show any results.Kindly guide me.