[GRASS-user] calculate the volume of a DEM

Hello,
Hi

Hello again,

I am trying to calculate the volume of a DEM using GRASS.

A DEM is usually elevation above sea level, so the “volume of a DEM” would be the the total volume from sea level to the DEM elevation. Is that what you want? Usually you want the volume between two rasters: the DEM and some base elevation. So you need to begin with a simple r.mapcalc expression to get the difference bwteen the DEM and the base elevation.

My bad, I chose the wrong words. I had two DEMS and I used r.mapcalc to get the difference between them. I want to calculate the total volume of this last raster.

For that I first calculated the area of my DEM using s.surf.area .
The result was 349 492.7m².
Then I used r.univar to get the number of cells, it is 822 244.
So the cell size is 349 492/822 244 = 0,42m²

You can get the cell size simply from r.info
Then r.univar gives the total of the cell values in it’s “sum” output.

So putting it all together, i.e.:

GRASS 7.4.0 (ITM):~ > r.info -g faran_lidar | grep "res"
nsres=1
ewres=1
# Cell size of 1 meter

GRASS 7.4.0 (ITM):~ > r.info -r faran_lidar
min=73.83
max=297.64
# Min max values

I don’t get what this last command is for?

Suppose I want the volume above 150 meters:

# Always remember to set region
GRASS 7.4.0 (ITM):~ > g.region -p rast=faran_lidar
# Prepare the "cut" raster between 150 and the DEM
r.mapcalc "faran_cut = if(faran_lidar>150, faran_lidar, null())"
# And get the sum of all cells:
GRASS 7.4.0 (ITM):~ > r.univar faran_cut | grep sum
100%
sum: 840009490.273132
*# Total 840 million cubic meters*

Done

So if do r.univar on my raster that I calculated with r.mapcalc before, it is enough? Or do I have to redo all the steps above? (I also set the region before)

I just have to multiply the “sum” result with the cell size?
Because you wrote that it is in cubic meters, but I though it was just in meters

To get the volume, I want to multiply this cell size with the total elevation value of my DEM. Where can I find this value? Is it the “sum” at the end of the r.univar report?

Yes

Otherwise, do you think my reasonning is correct to calculate the volume of a DEM?

Thank you for your help,
Marion

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)

Thank you for your help

···
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

Hi,

On Tue, Jul 10, 2018 at 6:04 AM, <marion-brunet@sfr.fr> wrote:
...

I had two DEMS and I used r.mapcalc to get
the difference between them. I want to calculate the total volume of this
last raster.

I wonder if
https://grass.osgeo.org/grass74/manuals/r.volume.html
could be of any use here?

Markus