<html style="direction: ltr;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-charset-is-forced="true" style="direction: ltr;"
text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div class="moz-cite-prefix">On 07/09/2018 06:05 AM, marion-brunet
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:790575905.2053.1531105524458.JavaMail.www@wsfrf1420"><span
style="font-family:arial,helvetica,sans-serif"><span
style="font-size:12px">Hello,<br>
</span></span></blockquote>
Hi<br>
<blockquote type="cite"
cite="mid:790575905.2053.1531105524458.JavaMail.www@wsfrf1420"><span
style="font-family:arial,helvetica,sans-serif"><span
style="font-size:12px">
<br>
I am trying to calculate the volume of a DEM using GRASS.</span></span><br>
</blockquote>
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.<br>
<br>
<blockquote type="cite"
cite="mid:790575905.2053.1531105524458.JavaMail.www@wsfrf1420">
<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²<br>
</span></blockquote>
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>
So putting it all together, i.e.:<br>
<br>
<tt>GRASS 7.4.0 (ITM):~ > r.info -g faran_lidar | grep "res"</tt><tt><br>
</tt><tt>nsres=1</tt><tt><br>
</tt><tt>ewres=1</tt><tt><br>
</tt><tt># Cell size of 1 meter</tt><br>
<br>
<tt>GRASS 7.4.0 (ITM):~ > r.info -r faran_lidar</tt><tt><br>
</tt><tt>min=73.83</tt><tt><br>
</tt><tt>max=297.64</tt><tt><br>
</tt><tt># Min max values</tt><br>
<br>
Suppose I want the volume above 150 meters:<br>
<br>
<tt># Always remember to set region</tt><tt><br>
</tt><tt>GRASS 7.4.0 (ITM):~ > g.region -p rast=faran_lidar</tt><tt><br>
</tt><tt># Prepare the "cut" raster between 150 and the DEM</tt><tt><br>
</tt><tt>r.mapcalc "faran_cut = if(faran_lidar>150, faran_lidar,
null())"</tt><tt><br>
</tt><tt># And get the sum of all cells:</tt><tt><br>
</tt><tt>GRASS 7.4.0 (ITM):~ > r.univar faran_cut | grep sum</tt><tt><br>
</tt><tt> 100%</tt><tt><br>
</tt><tt>sum: 840009490.273132</tt><tt><br>
</tt><tt># Total 840 million cubic meters</tt><br>
<br>
Done<br>
<blockquote type="cite"
cite="mid:790575905.2053.1531105524458.JavaMail.www@wsfrf1420"><span
style="font-size:12px">
<br>
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?<br>
</span></blockquote>
Yes<br>
<blockquote type="cite"
cite="mid:790575905.2053.1531105524458.JavaMail.www@wsfrf1420"><span
style="font-size:12px">
<br>
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>
<!--'"--><br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@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>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</body>
</html>