description.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <H2>DESCRIPTION</H2>
  2. <p><EM>r.terraflow</EM> takes as input a raster digital elevation
  3. model (DEM) and computes the flow direction raster and the flow
  4. accumulation raster, as well as the flooded elevation raster,
  5. sink-watershed raster (partition into watersheds around sinks) and tci
  6. (topographic convergence index) raster.
  7. <p><EM>r.terraflow</EM> computes these rasters using well-known
  8. approaches, with the difference that its emphasis is on the
  9. computational complexity of the algorithms, rather than on modeling
  10. realistic flow. <EM>r.terraflow</EM> emerged from the necessity of
  11. having scalable software able to process efficiently very large
  12. terrains. It is based on theoretically optimal algorithms developed
  13. in the framework of I/O-efficient algorithms. <EM>r.terraflow</EM>
  14. was designed and optimized especially for massive grids and is able to
  15. process terrains which were impractical with similar functions
  16. existing in other GIS systems.
  17. <p>Flow directions are computed using either the MFD (Multiple Flow
  18. Direction) model or the SFD (Single Flow Direction, or D8) model,
  19. illustrated below. Both methods compute downslope flow directions by
  20. inspecting the 3-by-3 window around the current cell. The SFD method
  21. assigns a unique flow direction towards the steepest downslope
  22. neighbor. The MFD method assigns multiple flow directions towards all
  23. downslope neighbors.
  24. <p>
  25. <table width=80% align=center>
  26. <tr>
  27. <th><img src="rterraflow_dir2.png" alt="[SFD]" border=0></th>
  28. <th><img src="rterraflow_dir3.png" alt="[SFD]" border=0></th>
  29. </tr>
  30. <tr>
  31. <th>Flow direction to steepest<br> downslope neighbor (SFD).</th>
  32. <th>Flow direction to all<br> downslope neighbors (MFD).</th>
  33. </tr>
  34. </table>
  35. <p>The SFD and the MFD method cannot compute flow directions for
  36. cells which have the same height as all their neighbors (flat areas)
  37. or cells which do not have downslope neighbors (one-cell pits).
  38. <ul>
  39. <li>On plateaus (flat areas that spill out) <EM>r.terraflow</EM>
  40. routes flow so that globally the flow goes towards the spill cells of
  41. the plateaus.
  42. <li>On sinks (flat areas that do not spill out, including one-cell
  43. pits) <EM>r.terraflow</EM> assigns flow by flooding the terrain until
  44. all the sinks are filled and assigning flow directions on the filled
  45. terrain.
  46. </ul>
  47. <p>
  48. In order to flood the terrain, <EM>r.terraflow</EM> identifies all
  49. sinks and partitions the terrain into sink-watersheds (a
  50. sink-watershed contains all the cells that flow into that sink),
  51. builds a graph representing the adjacency information of the
  52. sink-watersheds, and uses this sink-watershed graph to merge
  53. watersheds into each other along their lowest common boundary until
  54. all watersheds have a flow path outside the terrain. Flooding produces
  55. a sink-less terrain in which every cell has a downslope flow path
  56. leading outside the terrain and therefore every cell in the terrain
  57. can be assigned SFD/MFD flow directions as above.
  58. <p>
  59. Once flow directions are computed for every cell in the terrain,
  60. <EM>r.terraflow</EM> computes flow accumulation by routing water using
  61. the flow directions and keeping track of how much water flows through
  62. each cell.
  63. <P>
  64. If flow accumulation of a cell is larger than the value given by the
  65. <b>d8cut</b> option, then
  66. the flow of this cell is routed to its neighbors using the SFD (D8)
  67. model. This option affects only the flow accumulation raster and is
  68. meaningfull only for MFD flow (i.e. if the -s flag is not used); If
  69. this option is used for SFD flow it is ignored. The default value of
  70. <b>d8cut</b> is <i>infinity</i>.
  71. <P>
  72. <EM>r.terraflow</EM> also computes the tci raster (topographic convergence
  73. index, defined as the logarithm of the ratio of flow accumulation and
  74. local slope).
  75. <p>
  76. For more details on the algorithms see [1,2,3] below.
  77. <H2>NOTES</H2>
  78. One of the techniques used by <EM>r.terraflow</EM> is the
  79. space-time trade-off. In particular, in order to avoid searches, which
  80. are I/O-expensive, <EM>r.terraflow</EM> computes and works with an
  81. augmented elevation raster in which each cell stores relevant
  82. information about its 8 neighbors, in total up to 80B per cell. As a
  83. result <EM>r.terraflow</EM> works with intermediate temporary files
  84. that may be up to 80N bytes, where N is the number of cells (rows x
  85. columns) in the elevation raster (more precisely, 80K bytes, where K
  86. is the number of valid (not no-data) cells in the input elevation
  87. raster).
  88. <P>
  89. All these intermediate temporary files are stored in the path specified
  90. by the <b>STREAM_DIR</b> option. Note: <b>STREAM_DIR</b> must contain
  91. enough free disk space in order to store up to 2 x 80N bytes.
  92. <P>
  93. The <b>memory</b> option can be used to set the maximum amount of main
  94. memory (RAM) the module will use during processing. In practice its
  95. <I>value</I> should be an underestimate of the amount of available
  96. (free) main memory on the machine. <EM>r.terraflow</EM> will use at
  97. all times at most this much memory, and the virtual memory system
  98. (swap space) will never be used. The default value is 300 MB.
  99. <p>
  100. The internal type used by <EM>r.terraflow</EM> to store elevations
  101. can be defined at compile-time. By default, <EM>r.terraflow</EM> is
  102. compiled to store elevations internally as floats.
  103. A version which is compiled to store elevations internally as
  104. shorts is available as <EM>r.terraflow.short</EM>. Other versions can
  105. be created by the user if needed.
  106. <p>
  107. <EM>r.terraflow.short</EM> uses less space (up to 60B per cell, up
  108. to 60N intermediate file) and therefore is more space and time
  109. efficient. <EM>r.terraflow</EM> is intended for use with floating
  110. point raster data (FCELL), and <EM>r.terraflow.short</EM> with integer
  111. raster data (CELL) in which the maximum elevation does not exceed the
  112. value of a short SHRT_MAX=32767 (this is not a constraint for any
  113. terrain data of the Earth, if elevation is stored in meters).
  114. <p>
  115. Both <EM>r.terraflow</EM> and <EM>r.terraflow.short</EM> work with
  116. input elevation rasters which can be either integer, floating point or
  117. double (CELL, FCELL, DCELL). If the input raster contains a value that
  118. exceeds the allowed internal range (short for
  119. <EM>r.terraflow.short</EM>, float for <EM>r.terraflow</EM>), the
  120. program exits with a warning message. Otherwise, if all values in the
  121. input elevation raster are in range, they will be converted
  122. (truncated) to the internal elevation type (short for
  123. <EM>r.terraflow.short</EM>, float for <EM>r.terraflow</EM>). In this
  124. case precision may be lost and artificial flat areas may be created.
  125. <p>
  126. For instance, if <EM>r.terraflow.short</EM> is used with floating
  127. point raster data (FCELL or DCELL), the values of the elevation will
  128. be truncated as shorts. This may create artificial flat areas, and the
  129. outpus of <EM>r.terraflow.short</EM> may be less realistic than those
  130. of <EM>r.terraflow</EM> on floating point raster data.
  131. The outputs of <EM>r.terraflow.short</EM> and <EM>r.terraflow</EM> are
  132. identical for integer raster data (CELL maps).
  133. <P>
  134. The <b>stats</b> option defines the name of the file that contains the
  135. statistics (stats) of the run. The default name is <tt>stats.out</tt>
  136. (in the current directory).
  137. <H2>EXAMPLES</H2>
  138. <div class="code"><pre>
  139. r.terraflow elev=spearfish filled=spearfish-filled \
  140. dir=spearfish-mfdir swatershed=spearfish-watershed \
  141. accumulation=spearfish-accu tci=spearfish-tci
  142. </pre></div>
  143. <div class="code"><pre>
  144. r.terraflow elev=spearfish filled=spearfish-filled \
  145. dir=spearfish-mfdir swatershed=spearfish-watershed \
  146. accumulation=spearfish-accu tci=spearfish-tci d8cut=500 memory=800 \
  147. STREAM-DIR=/var/tmp/ stats=spearfish-stats.txt
  148. </pre></div>
  149. <H2>SEE ALSO</H2>
  150. <ul>
  151. <li>The <a
  152. href="http://www.cs.duke.edu/geo*/terraflow/">TerraFlow</a> project at Duke University
  153. <li><a href=r.flow.html>r.flow</a>,
  154. <A HREF="r.basins.fill.html">r.basins.fill</A>,
  155. <A HREF="r.drain.html">r.drain</A>,
  156. <a href="r.topidx.html">r.topidx</a>,
  157. <a href="r.topmodel.html">r.topmodel</a>,
  158. <A HREF="r.water.outlet.html">r.water.outlet</A>,
  159. <A HREF="r.watershed.html">r.watershed</A>
  160. </ul>
  161. <H2>AUTHORS</H2>
  162. <dl>
  163. <dt>Original version of program: The <a
  164. href="http://www.cs.duke.edu/geo*/terraflow/">TerraFlow</a> project,
  165. 1999, Duke University.
  166. <dd><a href="http://www.cs.duke.edu/~large/">Lars Arge</a>,
  167. <a href="http://www.cs.duke.edu/~chase/">Jeff Chase</a>,
  168. <a href="http://www.env.duke.edu/faculty/bios/halpin.html">Pat Halpin</a>,
  169. <a href="http://www.cs.duke.edu/~laura/">Laura Toma</a>,
  170. <a href="http://www.env.duke.edu/faculty/bios/urban.html">Dean Urban</a>,
  171. <a href="http://www.cs.duke.edu/~jsv/">Jeff Vitter</a>,
  172. <a href="http://www.cs.duke.edu/~rajiv/">Rajiv Wickremesinghe</a>.
  173. <dt>Porting for GRASS, 2002:
  174. <dd> <a href="http://www.cs.duke.edu/~large/">Lars Arge</a>,
  175. <a href="http://skagit.meas.ncsu.edu/~helena/index.html">Helena Mitasova,</a>
  176. <a href="http://www.cs.duke.edu/~laura/">Laura Toma</a>.
  177. <dt>Contact: <a href="mailto:laura@cs.duke.edu"> Laura Toma</a></dt>
  178. </dl>
  179. <H2>REFERENCES</H2>
  180. <ol>
  181. <li><A NAME="arge:drainage"
  182. HREF="http://www.cs.duke.edu/geo*/terraflow/papers/alenex00_drainage.ps.gz">
  183. I/O-efficient algorithms for problems on grid-based
  184. terrains</A>. Lars Arge, Laura Toma, and Jeffrey S. Vitter. In
  185. <EM>Proc. Workshop on Algorithm Engineering and Experimentation</EM>,
  186. 2000. To appear in <EM>Journal of Experimental Algorithms</EM>.
  187. <li><A NAME="terraflow:acmgis01"
  188. HREF="http://www.cs.duke.edu/geo*/terraflow/papers/acmgis01_terraflow.pdf">
  189. Flow computation on massive grids</A>.
  190. Lars Arge, Jeffrey S. Chase, Patrick N. Halpin, Laura Toma,
  191. Jeffrey S. Vitter, Dean Urban and Rajiv Wickremesinghe. In
  192. <EM>Proc. ACM Symposium on Advances in Geographic Information
  193. Systems</EM>, 2001.
  194. <li><A NAME="terraflow:geoinformatica"
  195. HREF="http://www.cs.duke.edu/geo*/terraflow/papers/journal_terraflow.pdf">
  196. Flow computation on massive grid terrains</A>.
  197. Lars Arge, Jeffrey S. Chase, Patrick N. Halpin, Laura Toma,
  198. Jeffrey S. Vitter, Dean Urban and Rajiv Wickremesinghe.
  199. To appear in <EM>GeoInformatica, International Journal on
  200. Advances of Computer Science for Geographic Information
  201. Systems</EM>.
  202. </ol>
  203. <p>
  204. <i>Last changed: $Date$</i>