[GRASS-user] calculate the volume of a DEM

marion-brunet at sfr.fr marion-brunet at sfr.fr
Mon Jul 9 21:04:52 PDT 2018


<span style="font-family:arial,helvetica,sans-serif; font-size:12px">‌</span>

<div class="gl_quote" style="margin-top: 20px; padding-top: 5px;">
<div class="gl_quoted">
<div class="gl_quote" style="margin-top: 20px; padding-top: 5px;">
<div class="gl_quoted">
<blockquote cite="mid:790575905.2053.1531105524458.JavaMail.www at wsfrf1420" type="cite"><span style="font-family:arial,helvetica,sans-serif"><span style="font-size:12px">Hello,</span></span><br>
Hi</blockquote>
Hello again,

<blockquote cite="mid:790575905.2053.1531105524458.JavaMail.www at wsfrf1420" type="cite"><br>
<span style="font-family:arial,helvetica,sans-serif"><span style="font-size:12px">I am trying to calculate the volume of a DEM using GRASS.</span></span><br>
<br>
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.</blockquote>
<br>
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.<br>
 
<blockquote cite="mid:790575905.2053.1531105524458.JavaMail.www at wsfrf1420" type="cite"><br>
<span style="font-size:12px"><span style="font-family:arial,helvetica,sans-serif">For </span></span><span style="font-family:arial,helvetica,sans-serif"><span style="font-size:11px"><span style="font-size:12px">that</span></span><span style="font-size:12px"> I first calculated the area of my DEM using s.surf.</span><span style="font-size:11px"><span style="font-size:12px">area .</span></span></span><br>
<span style="font-size:12px"><span style="font-family:arial,helvetica,sans-serif">The result was </span>349 492.7m².<br>
Then I used r.univar to get the number of cells, it is 822 244.<br>
So the cell size is 349 492/822 244 = 0,42m²</span><br>
<br>
You can get the cell size simply from r.info<br>
Then r.univar gives the total of the cell values in it's "sum" output.<br>
<br>
So putting it all together, i.e.:<br>
<br>
<tt>GRASS 7.4.0 (ITM):~ > r.info -g faran_lidar | grep "res"</tt><br>
<tt>nsres=1</tt><br>
<tt>ewres=1</tt><br>
<tt># Cell size of 1 meter</tt><br>
<br>
<tt>GRASS 7.4.0 (ITM):~ > r.info -r faran_lidar</tt><br>
<tt>min=73.83</tt><br>
<tt>max=297.64</tt><br>
<tt># Min max values</tt></blockquote>
<br>
I don't get what this last command is for?<br>
<br>
<br>
<em>Suppose I want the volume above 150 meters:<br>
<br>
<tt># Always remember to set region</tt><br>
<tt>GRASS 7.4.0 (ITM):~ > g.region -p rast=faran_lidar</tt><br>
<tt># Prepare the "cut" raster between 150 and the DEM</tt><br>
<tt>r.mapcalc "faran_cut = if(faran_lidar>150, faran_lidar, null())"</tt><br>
<tt># And get the sum of all cells:</tt><br>
<tt>GRASS 7.4.0 (ITM):~ > r.univar faran_cut | grep sum</tt><br>
<tt> 100%</tt><br>
<tt>sum: 840009490.273132</tt></em><br>
<tt><em># Total 840 million cubic meters</em></tt><br>
<br>
<em>Done</em><br>
<br>
<br>
<br>
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)<br>
<br>
I just have to multiply the "sum" result with the cell size?<br>
Because you wrote that it is in cubic meters, but I though it was just in meters<br>
<br>
 
<blockquote cite="mid:790575905.2053.1531105524458.JavaMail.www at wsfrf1420" type="cite"><br>
<span style="font-size:12px">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?</span></blockquote>
Yes

<blockquote cite="mid:790575905.2053.1531105524458.JavaMail.www at wsfrf1420" type="cite"><br>
<span style="font-size:12px">Otherwise, do you think</span><span style="font-size:11px"><span style="font-size:12px"> my</span></span><span style="font-size:12px"> reasonning is correct to calculate the volume of a DEM?<br>
<br>
Thank you for your help,<br>
Marion</span><br>
  <!--'"-->
<fieldset class="mimeAttachmentHeader"> </fieldset>
 

<pre wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user at lists.osgeo.org">grass-user at lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a></pre>
</blockquote>
Thank you for your help

<pre class="moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</div>

<div class="gl_quoted"> </div>
</div>
</div>

<div class="gl_quoted"> </div>
</div>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180710/ea77e9c8/attachment-0001.html>


More information about the grass-user mailing list