[GRASS-user] calculate the volume of a DEM

marion-brunet at sfr.fr marion-brunet at sfr.fr
Wed Jul 11 01:46:29 PDT 2018


<span style="font-family:arial,helvetica,sans-serif; font-size:12px">‌Thank you for this clarification, one last question:<br>
the cell size is nsres*ewres right?</span>

<div class="gl_quote" style="margin-top: 20px; padding-top: 5px;">De : "Micha Silver"<br>
A : marion-brunet at sfr.fr<br>
Envoyé: mardi 10 juillet 2018 21:06<br>
Objet : Re: [GRASS-user] calculate the volume of a DEM<br>
 
<div class="gl_quoted"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; }
</style>
<br>
 
<div class="moz-cite-prefix">On 07/10/2018 06:05 AM, <a class="moz-txt-link-abbreviated" href="mailto:marion-brunet at sfr.fr">marion-brunet at sfr.fr</a> wrote:</div>

<blockquote cite="mid:1392724731.1181.1531191958732.JavaMail.www at wsfrf1420" type="cite"><br>
<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">
<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.</div>
</div>
</blockquote>
<br>
Ah, OK, it's clear now.<br>
 
<blockquote cite="mid:1392724731.1181.1531191958732.JavaMail.www at wsfrf1420" type="cite">
<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"><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?</div>
</div>
</blockquote>
Just to see the range of values<br>
 
<blockquote cite="mid:1392724731.1181.1531191958732.JavaMail.www at wsfrf1420" type="cite">
<div class="gl_quote" style="margin-top: 20px; padding-top: 5px;">
<div class="gl_quoted"><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</div>
</div>
</blockquote>
<br>
r.univar is all you need, but yes you must multiply by the cell size. If your DEM is meters and your cell size is 10 meters, then the r.univar sum result is in units of 10x10x1 = 100 cubic meters. So you would multiply the sum by 100 to get cubic meters.<br>
 
<blockquote cite="mid:1392724731.1181.1531191958732.JavaMail.www at wsfrf1420" type="cite">
<div class="gl_quote" style="margin-top: 20px; padding-top: 5px;">
<div class="gl_quoted"> </div>
</div>
</blockquote>
 

<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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180711/1d3ec490/attachment-0001.html>


More information about the grass-user mailing list