R에서 두 개의 디지털 고도 모델 (DEM) 을 비교하는 방법
#-------------------------------------------------------------------------
#Creating a reproducible example
library(raster)
#simulating raster_1
f = system.file("external/test.grd", package="raster")
DEM_1 = raster(f)
#simulating raster_2
DEM_2 = DEM_1
# replacing values from raster_1 to create a new raster sample (raster_2)
DEM_2[(DEM_2>500 & DEM_2<900)] = 550
DEM_2[(DEM_2>200 & DEM_2<300)] = 500
#-------------------------------------------------------------------------
# Comparison 1 (DEM_3 resulted from subtracting DEM_2 from DEM_1)
DEM_3 = DEM_1 - DEM_2
par(mfrow=c(1,3))
plot(DEM_1, main = "DEM_1")
plot(DEM_2, main = "DEM_2")
plot(DEM_3, main = "DEM_3 = DEM_1 - DEM_2")
dev.off()
#-------------------------------------------------------------------------
#Comparison 2 (histogram)
hist(DEM_1, prob=T, main="DEM_1", xlab="")
hist(DEM_2, prob=T, main="DEM_2", xlab="")
hist(DEM_3, prob=T, main="DEM_3 = DEM_1 - DEM_2", xlab="")
par(mfrow=c(1,1))
standard_deviation = sd(c(as.matrix(DEM_3)),na.rm=T)
dev.off()
#-------------------------------------------------------------------------
#comparison 3 (RMSE)
library(hydroGOF)
DEM_1_matrix = c(as.matrix(DEM_1))
DEM_2_matrix = c(as.matrix(DEM_2))
rmse = rmse(DEM_1_matrix,DEM_2_matrix)
rmse
[1] 135.3675 # this is the root mean squared error (RMSE) result.
ArcGIS for Desktop을 사용하여 만든 두 개의 TIN 비교에 대한 @whuber의 답변을 참조하십시오 . 이 문제에 대한 이론적 통찰력.