On 07/09/2018 06:05 AM, marion-brunet wrote:
‌Hello,
Hi

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.


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

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

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
https://lists.osgeo.org/mailman/listinfo/grass-user

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

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to