[GRASS-user] calculate the volume of a DEM with r.volume

Moritz Lennert mlennert at club.worldonline.be
Fri Jul 13 08:41:09 PDT 2018


On 13/07/18 09:51, marion-brunet at sfr.fr wrote:
> ‌Hello,
> 
> I am working on Windows and I tried using GRASS 7.2.2, GRASS 7.4.0 and 
> GRASS 7.4.1 to see if there is any difference, but it is always the same.
> 
> I have a ratser map calleddec-juin
> First I didr.clump input=dec-juin at 1217_Interpo0618 output=test
> to get the clumps
> Then I didr.volume input=dec-juin at 1217_Interpo0618 
> clump=test at 1217_Interpo0618
> to have the volume.


If dec-juin at 1217_Interpo0618 contains your DEM difference, than you will 
have different values for each pixel and clumping the map will results 
in almost as many clumps as pixels. The clumps are meant to be used to 
delineate specific areas for which you want the volume. If you want the 
total volume of the entire computational region, you can just create a 
map with r.mapcalc like this:

r.mapcalc "clump = 1"

and then run

r.volume input=dec-juin at 1217_Interpo0618 clump=clump

which should give you the total volume.

Ideally, the clump option of r.volume should be optional. You could file 
an enhancement wish on trac for that.

Then again, as Micha has already explained, you can get the same result 
simply doing

r.sum dec-juin at 1217_Interpo0618

and then multply the result by the area of your pixels (ewres*nsres).

Moritz

> The result I have is:
> 
> (Fri Jul 13 14:12:45 2018)
> r.volume input=dec-juin at 1217_Interpo0618 clump=test at 1217_Interpo0618
> Volume report on data from <dec-juin at 1217_Interpo0618> using clumps on 
> <test at 1217_Interpo0618> raster map
> Category   Average   Data   # Cells        Centroid             Total
> Number     in clump  Total  in clump   Easting     Northing     Volume
> -----------------------------------------------------------------------------
>         1     -8.02       -72       9   191262.28  1222178.97           
> -22.59
>         2     -9.02      -622      69   191265.64  1222177.29          
> -194.78
>         3     -8.04      -394      49   191268.44  1222176.73          
> -123.30
>         4     -7.08      -276      39   191271.23  1222177.85           
> -86.46
>         5     -5.94      -427      72   191274.59  1222176.73          
> -133.75
>         6     -4.30      -275      64   191285.22  1222178.97           
> -86.09
>         7     -5.10     -2714     532   191288.58  1222174.50          
> -849.47
>         8     -0.60        -7      12   191221.43  1222177.29            
> -2.27
>         9     -8.95     -1030     115   191230.39  1222176.17          
> -322.31
>        10    -10.06     -1217     121   191245.49  1222175.61          
> -380.88
>        11    -10.93     -1956     179   191249.97  1222177.29          
> -612.34
>        12    -10.24      -645      63   191259.48  1222175.61          
> -201.92
>        13     -7.05      -621      88   191329.43  1222177.29          
> -194.28
>        14     -7.51       -60       8   191336.14  1222177.29           
> -18.81
>        15     -7.47       -30       4   191337.26  1222177.29            
> -9.35
>        16     -8.04      -322      40   191340.06  1222177.29          
> -100.63
>        17     -8.99      -108      12   191343.98  1222177.29           
> -33.78
>        18      4.98        45       9   191182.26  1222175.05            
> 14.03
>        etc
>        etc
>     24458     -5.50       -22       4   191397.13  1221585.50            
> -6.88
>     24459     -5.51       -33       6   191378.11  1221584.39           
> -10.34
>     24460     -5.52       -11       2   191380.91  1221584.39            
> -3.45
>     24461     -5.27    -30348    5764   191309.84  1221601.17         
> -9498.51
>     24462     -5.49       -38       7   191358.53  1221582.15           
> -12.02
>     24463     -5.49       -22       4   191363.56  1221583.83            
> -6.87
>     24464     -5.48       -11       2   191385.38  1221583.83            
> -3.43
>     24465     -5.49       -11       2   191387.06  1221583.83            
> -3.44
>     24466     -5.50       -11       2   191388.74  1221583.83            
> -3.44
>     24467     -5.50       -22       4   191360.20  1221582.71
>             -6.88
>     24468     -5.92   -523187   88358   191241.58  1221675.00       
> -163750.63
> (Fri Jul 13 14:13:03 2018) La commande s'est terminée (18 sec)
> 
> As you can see, I have nothing at the end of the command... But I know 
> it is finished, because when I created the clumps it said that it 
> created 24468 clumps.
> Do you need any more information?
> 
> 
> Thank you very much
> De : "Markus Neteler"
> A : marion-brunet at sfr.fr,"grass-user"
> Envoyé: jeudi 12 juillet 2018 16:43
> Objet : Re: [GRASS-user] calculate the volume of a DEM with r.volume
> Hello Marion,
> 
> On Wed, Jul 11, 2018 at 10:32 AM,  <marion-brunet at sfr.fr 
> <mailto:marion-brunet at sfr.fr>> wrote:
>  > Hello,
>  >
>  > I tried using r.volume as you suggested.  According to the 
> documentation it
>  > is suitable for what I am trying to do.
>  >
>  > However, when I use it, I don't have the "Total volume" line at the 
> end of
>  > the report, like it is shown in the documentation. I just have the total
>  > volume of each clump, but not of all the clumps... Has it ever 
> happened to
>  > you when using this command?
> 
> That's weird! Which version/operating system do you use?
> 
>  > in the command line
>  >
>  > I simply wroter.volume input=difference clump=clump in the command line
> 
> 
> Here on command line:
> 
> GRASS 7.4.1svn (nc_spm_08_grass7):~ > g.region raster=elevation
> GRASS 7.4.1svn (nc_spm_08_grass7):~ > r.volume input=elevation 
> clump=geology_30m
>   100%
> 
> Volume report on data from <elevation> using clumps on <geology_30m> 
> raster map
> 
> Category   Average   Data   # Cells        Centroid             Total
> Number     in clump  Total  in clump   Easting     Northing     Volume
> -----------------------------------------------------------------------------
>       217    118.93  86288828  725562   635325.00   221535.00   
>   8628882798.63
>       262    108.97  21650560  198684   638935.00   222495.00   
>   2165056037.02
>       270     92.23  63578874  689373   642405.00   221485.00   
>   6357887443.53
>       405    132.96  33732662  253710   631835.00   224095.00   
>   3373266208.59
>       583    139.35   3011288   21609   630205.00   224665.00     
> 301128821.55
>       720    124.30    599618    4824   634075.00   227995.00     
>   59961816.06
>       766    132.43    936791    7074   631425.00   227845.00     
>   93679120.08
>       862    118.31   7302317   61722   630505.00   218885.00     
> 730231746.74
>       910     94.20   4235816   44964   639215.00   216365.00     
> 423581613.11
>       921    135.22   1693985   12528   630755.00   215445.00     
> 169398523.05
>       945    127.24      1145       9   630015.00   215015.00       
>   114512.03
>       946     89.91    365748    4068   639085.00   215255.00     
>   36574833.85
>       948    129.02    112632     873   630185.00   215115.00     
>   11263181.57
> -----------------------------------------------------------------------------
>                                                  Total Volume = 
> 22351026655.81
> ... which looks ok.
> Can you say a bit more about your system?
> Markus
> 
> 
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
> 




More information about the grass-user mailing list