[GRASS-user] calculate the volume of a DEM

‌Thank you for this clarification, one last question:
the cell size is nsres*ewres right?

···

On 07/10/2018 06:05 AM, marion-brunet@sfr.fr wrote:

‌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

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

Yes, exactly

···

On 07/11/2018 11:46 AM, marion-brunet@sfr.fr wrote:

‌Thank you for this clarification, one last question:
the cell size is nsres*ewres right?

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