Volume Calculation of Area for Reservoir Analysis using Grass

I think you could replace steps 5-9 with a simple awk program.
But anyway, ain't grass+unix tools wonderful!

Simon Cox

Yes, GRAASS can be used to do volumetric calculations. There is no
straightforward program, but the following outline will start you
in the right direction:

1) Use the screen-oriented digitizing capability to outline the anticipated
extent of the area for which a volume will be calculated.

2) Use the masking program to mask into this area

3) Subtract the DEM values from the fill height value using r.mapcalc

4) Run r.stats on the results
     You now have something like:
       -1 1357
       1 3456
       2 1234
       ...
       (The first value is the delta h (height), the second the area)

5) Filter out negative values (areas where the DEM height is greater than
   the fill height). (Use sed(1))
     You now have something like:
       1 3456
       2 1234
       ...

6) Turn the output into a bc(1) input script where the height values are
   multiplied by their corresponding area values.
     You now have something like:
       1 * 3456
       2 * 1234
       ...

7) Send the result through bc(1)
     You now have something like:
       3456
       2468
       ...

8) Sum these values; add the appropriate dc(1) commands:
     You now have something like:
       3456
       2468 +
       ...
       p

9) Send through dc(1) for your final volume

----
__________________________________________________________________
        Dr Simon Cox
         __ L
      ,~' L_|\ Department of Earth Sciences
   ,-' \ Monash University
   ( \ Clayton Vic 3168 Australia
   \ ___ /
    L,~' "\_x/ Phone +61 3 565 5762
              u Fax +61 3 565 5062
        simon@cerberus.earth.monash.edu.au
__________________________________________________________________