[GIS] Calculate volume from raster (GRASS) with depth per cell

grassqgisvolume

I'm trying to calculate the volumes of depression areas filled with water. I have the depth for each cell in the raster, and I'm trying to get the total volume of cells adjacent to each other. Which I then, in step 2, need to remove all the bodies of water lower than a given threshold and then convert the file to vector/shp format.

I've trying using the r.clump and then r.volume function in qgis, but I keep getting this error:

ERROR: r.volume: Sorry, is not a valid parameter
ERROR: Required parameter not set:
(Name of input raster map representing data that will be summed within clumps)

C:\PROGRA~1\QGIS2~1.18\bin>v.out.ogr -s -e input=centroids0814b2718bf14943909f424cebd714fb type=auto output="C:\Users\JGJ\AppData\Local\Temp\processing503b826c304e474ebc5a9862a9dd29e1\b97bc604e110497ab8dde2cc3da478e7" format=ESRI_Shapefile output_layer=centroids
ERROR: Vector map not found

C:\PROGRA~1\QGIS2~1.18\bin>exit
Converting outputs
Loading resulting layers

The following layers were not correctly generated.
Centroids
You can check the log messages to find more information about the execution of the algorithm

I could not get the above to work, but managed a workaround.

I have converted raster to vector, and calculated each polygons volume. I have a lot of polygons I want to dissolve into a lot of larger polygons, which can be done with Dissolve. However each of the small polygon has a volume too it, that needs to be summed up. If I do a dissolve it just adds the total volume of all the polygons in the layer, and not those that get dissolved. Added a concept picture.

enter image description here

Best Answer

Are you aware that the output from r.clump does not have the depths? Each clump is given a unique category value, so you no longer have the cell depths. You can get the area of each clump, but not the total volume.

If I understand correctly your goal, you should convert the "clumps" to a polygon vector, then use v.rast.stats to get the total depth for each clump area. i.e.:

v.rast.stats map=clumps raster=depths column_pref=depth method=sum,minimum,maximum,range

This will add four new columns to the area vector of "clumps" with total volume, min and max depths, and the range of depths.

I'd also suggest you try to do this procedure directly in GRASS, rather than thru the processing toolbox in QGIS.

Related Question