I believe you can use some map algebra (raster > raster calculator) before you can preform your volume measurements in grass.
Assuming that your bathymetric data use positive values to represent the sea depth, and using your example for the range as 50 the min_depth and 200 the max_depth. For each of the raster cells you need to "remove" anything below the 200 and above the 50. You have 3 possible situations:
your cell depth is higher than the max_depth
(@bathymetry > 200)
your cell depth in the min_depth - max_depth range
(@bathymetry <= 200) * (@bathymetry >= 50)
your cell depth is lower that your min_depth
(@bathymetry < 50)
In case 1 the size of the water column will be the entire size of our range:
(@bathymetry > 200.0) * (200.0 - 50.0)
In case 2 the "water column" is from your bathimetry depth until the minimum value of the range:
(@bathymetry <= 200.0) * (@bathymetry > 50.0)*(@bathymetry - 50.0)
In case 3 there is no useful "water column" for your specie therefore it would be:
(@bathymetry <= 50)*0.0
Since the 3 cases never occurs at the same time, all we need is to sum the expressions:
(@bathymetry > 200.0) * (200.0 - 50.0) + (@bathymetry <= 200.0) * (@bathymetry > 50.0)*(@bathymetry - 50.0) + (@bathymetry <= 50)*0.0
Since the last expression is always zero, the is no point in including it:
(@bathymetry > 200.0) * (200.0 - 50.0) + (@bathymetry <= 200.0) * (@bathymetry > 50.0)*(@bathymetry - 50.0)
And the generic version of the expression would be:
(@bathymetry > max_depth) * (max_depth - min_depth) + (@bathymetry <= max_depth) * (@bathymetry > min_depth)*(@bathymetry - min_depth)
After this, you can use the output raster in r.volume to sum all "water columns" values
There's a python example in the GDAL/OGR Raster Cookbook (look for 'Least Cost Path analysis'). You'll need to install scikit-image for that.
If using QGIS:-
- To get your cost raster, generate a slope raster in the usual way
- then use Raster Calculator to set any slope pixel above a threshold to a really high value like 9999
- to find your coordinates for the script, use the Coordinate Capture plugin
That will find the route with the least overall slope between A and B. The output is a binary raster.
It won't necessarily be the shortest path distance-wise, but it would represent the easiest route between A and B (for example, for hillwalkers or cyclists)
Best Answer
The usage of SAGA
raster volume
is slightly different from what you would expect with ArcGISCut/Fill
, as it is a tool to calculate a volume above a reference surface.How about simply using QGIS
Raster Calculator
?(1) Subtract
raster_b
fromraster_a
(2) You will obtain output raster.
(3) If it was ArcGIS
Cut Fill
tool, it will immediately give youCut volume
andFill volume
summarized in a table. With QGIS, you would probably useRaster layer statistics
tool (in QGIS geoalgorithm | Raster tools) or other plugins, which fits for your target statistics.