r3.out.ascii.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <h2>DESCRIPTION</h2>
  2. <em>r3.out.ascii</em> exports a 3D raster map in ASCII format. The <em>input</em> parameter is
  3. a valid 3D raster map in the current mapset search path. The <em>output</em>
  4. parameter is the name of an ASCII file which will be written in the
  5. current working directory.
  6. <p>If <em>output</em> is not specified then standard output (stdout) is used.
  7. The <em>-h</em> flag may be used to suppress header information. The
  8. module is sensitive to region settings (set with <em>g.region</em>).
  9. <p>The <em>-c</em> flag will create GRASS 6 <em>r3.in.ascii</em> compatible
  10. output.
  11. <h2>NOTES</h2>
  12. The default format of the exported ASCII file is equivalent to that required
  13. by <em>r3.in.ascii</em>. In particular, files output by
  14. <em>r3.out.ascii</em> with header information may be converted back to
  15. 3D raster maps with <em>r3.in.ascii</em>.
  16. <p>
  17. The format of the ASCII file is:
  18. <div class="code"><pre>
  19. version: <i>"grass7"</i>
  20. order: <i>"nsbt" or "nstb" or "snbt" or "sntb"</i>
  21. north: <i>floating point</i>
  22. south: <i>floating point</i>
  23. east: <i>floating point</i>
  24. west: <i>floating point</i>
  25. top: <i>floating point</i>
  26. bottom: <i>floating point</i>
  27. rows: <i>integer</i>
  28. cols: <i>integer</i>
  29. levels: <i>integer</i>
  30. </pre></div>
  31. The <b>version</b> and <b>order</b> options have been introduced in GRASS 7 in June 2011.
  32. The <b>order</b> option describes the order of rows and depths in the output.
  33. It is possible to create output of different row order using the <em>-r</em> flag
  34. and output of different depths order using the <em>-d</em> flag. The default order is:
  35. <p><div class="code"><pre>
  36. west -&gt; east for columns
  37. north -&gt; south for rows
  38. bottom -&gt; top for depths
  39. </pre></div>
  40. <p>
  41. This header is followed by the cell values in <em>floating point</em> format
  42. organized in rows with constant <em>col</em> and <em>level</em> coordinate.
  43. The rows are organized by constant <em>level</em> coordinate. Individual cell
  44. values are separated by <em>space</em> or <em>CR</em>.
  45. Cell values are exported as a series of horizontal slices in row-major
  46. order. The data starts with the upper left corner (NW) at the bottom of the data set.
  47. The values at the following coordinates are exported:
  48. <div class="code"><pre>
  49. (x, y + rows, z) (x + 1, y + rows, z) ... (x + cols, y + rows, z)
  50. (x, y + rows, z) (x + 1, y + rows - 1, z) ... (x + cols, y + rows - 1, z)
  51. . . .
  52. . . .
  53. . . .
  54. (x, y, z + depths) (x + 1, y, z + depths) ... (x + cols, y, z + depths)
  55. </pre></div>
  56. This order is compatible with the <em>r.in.ascii</em> row -&gt; column ordering.
  57. <p>
  58. Supported orders are:
  59. <ul>
  60. <li><b>nsbt</b>: north -&gt; south and bottom -&gt; top ordering which is the default (no flags)</li>
  61. <li><b>snbt</b>: south -&gt; north and bottom -&gt; top ordering using <em>-r</em> flag</li>
  62. <li><b>nstb</b>: north -&gt; south and top -&gt; bottom ordering using <em>-d</em> flag</li>
  63. <li><b>sntb</b>: south -&gt; north and top -&gt; bottom ordering using <em>-rd</em> flag</li>
  64. </ul>
  65. <p>
  66. The internal storage scheme of 3D raster maps is visualized in the following picture:
  67. <center>
  68. <img src="raster3d_layout.png" border=0><br>
  69. <table border=0 width=700>
  70. <tr><td><center>
  71. <i>The coordinate system and tile layout of a voxel map in GRASS</i>
  72. </center></td></tr>
  73. </table>
  74. </center>
  75. <p>
  76. One level maps can be imported with <em>r.in.ascii</em> (2D raster) using
  77. the default <b>nsbt</b> order and removing the header lines "version",
  78. "order", "top", "bottom" and "levels".
  79. <h2>Example</h2>
  80. We define a small region with 4 columns, 3 rows and 2 depths (4x3x2) and export
  81. it using different ordering definitions:
  82. <div class="code"><pre>
  83. g.region res3=1 t=2 b=0 w=0 e=4 s=0 n=3
  84. r3.mapcalc "simple_example = row() + col() + depth()"
  85. </pre></div>
  86. Default order:
  87. <div class="code"><pre>
  88. r3.out.ascii input=simple_example dp=0
  89. version: grass7
  90. order: nsbt
  91. north: 3.000000
  92. south: 0.000000
  93. east: 4.000000
  94. west: 0.000000
  95. top: 2.000000
  96. bottom: 0.000000
  97. rows: 3
  98. cols: 4
  99. levels: 2
  100. 3 4 5 6
  101. 4 5 6 7
  102. 5 6 7 8
  103. 4 5 6 7
  104. 5 6 7 8
  105. 6 7 8 9
  106. </pre></div>
  107. Inverse row order (-r)
  108. <div class="code"><pre>
  109. r3.out.ascii input=simple_example dp=0 -r
  110. version: grass7
  111. order: snbt
  112. north: 3.000000
  113. south: 0.000000
  114. east: 4.000000
  115. west: 0.000000
  116. top: 2.000000
  117. bottom: 0.000000
  118. rows: 3
  119. cols: 4
  120. levels: 2
  121. 5 6 7 8
  122. 4 5 6 7
  123. 3 4 5 6
  124. 6 7 8 9
  125. 5 6 7 8
  126. 4 5 6 7
  127. </pre></div>
  128. Inverse depth order (-d)
  129. <div class="code"><pre>
  130. r3.out.ascii input=simple_example dp=0 -d
  131. version: grass7
  132. order: nstb
  133. north: 3.000000
  134. south: 0.000000
  135. east: 4.000000
  136. west: 0.000000
  137. top: 2.000000
  138. bottom: 0.000000
  139. rows: 3
  140. cols: 4
  141. levels: 2
  142. 4 5 6 7
  143. 5 6 7 8
  144. 6 7 8 9
  145. 3 4 5 6
  146. 4 5 6 7
  147. 5 6 7 8
  148. </pre></div>
  149. Inverse row and depth order (-rd)
  150. <div class="code"><pre>
  151. r3.out.ascii input=simple_example dp=0 -rd
  152. version: grass7
  153. order: sntb
  154. north: 3.000000
  155. south: 0.000000
  156. east: 4.000000
  157. west: 0.000000
  158. top: 2.000000
  159. bottom: 0.000000
  160. rows: 3
  161. cols: 4
  162. levels: 2
  163. 6 7 8 9
  164. 5 6 7 8
  165. 4 5 6 7
  166. 5 6 7 8
  167. 4 5 6 7
  168. 3 4 5 6
  169. </pre></div>
  170. <h2>SEE ALSO</h2>
  171. <em>
  172. <a href="r3.in.ascii.html">r3.in.ascii</a>,
  173. <a href="r.out.ascii.html">r.out.ascii</a>,
  174. <a href="g.region.html">g.region</a>
  175. </em>
  176. <h2>AUTHORS</h2>
  177. Roman Waupotitsch, Michael Shapiro,
  178. Helena Mitasova, Bill Brown, Lubos Mitas, Jaro Hofierka, S&ouml;ren Gebbert
  179. <p><i>Last changed: $Date$</i>