How to compare accuracy of two DEM using GRASS

How do I compare accuracy of two DEM data (lidar and srtm) (possibly through rmse) using GRASS GIS?

• possible duplicate of comparing two DEMs
– Paul
Oct 20 '13 at 23:36
• The proposed duplicate is about arcgis. Oct 21 '13 at 2:40

The proposed duplicate is perhaps about ArcGIS but a solution is provided with R

The general solution has been given by whuber in comparing two TINs:

Consider converting both TINs to raster format, where a little map algebra does the rest. For example, the RMS measure of difference between the TINs is obtained by subtracting one grid from the other, squaring the result, and taking the square root of its average value. The answer depends on the cellsize (and grid origin) you use, but as the cellsize grows small, the answer will converge to the one you would obtain using the TINs directly.

And there are many others comments of whuber on the subject as:

The right approach, for all DEMs, is just to subtract one raster from the other and screen for outliers...

In GRASS GIS, for map algebra, you have the module r.mapcalc and the interface r.mapcalculator. It performs most any calculation between and within maps that you could think of.

You can also compute a visual comparison of 2 two DEMS, see in GRASS GIS: raster, vector, and imagery analysis

Or you can directly use R from the GRASS shell and the solution given by Andre Silva in the possible duplicate link.

(with and old version of R in the figure) And after:

> library(spgrass6)
> G <- gmeta6()
> mydems <- readRAST6(c("asterwall@aster", "walldemRW@PERMANENT"),cat=c(TRUE, FALSE), ignore.stderr=TRUE,plugin=NULL)