r.mask.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <h2>DESCRIPTION</h2>
  2. <em><b>r.mask</b></em> - Facilitates creation of a raster "MASK" map to
  3. control raster operations.
  4. <p>
  5. The MASK is only applied when <em>reading</em> an existing GRASS raster map,
  6. for example when used in a module as an input map.
  7. The MASK will block out certain areas of a raster map from analysis and/or
  8. display, by "hiding" them from sight of other GRASS modules. Data falling
  9. within the bounaries of the MASK can be modified and operated upon by other
  10. GRASS raster modules; data falling outside the MASK is treated as if it were NULL.
  11. <p>
  12. Because the MASK is actually only a reclass map named "MASK", it can be
  13. copied, renamed, removed, and used in analyses, just like other GRASS
  14. raster map layers. The user should be aware that a MASK remains in
  15. place until a user renames it to something other than "MASK", or removes
  16. it using "<tt>r.mask -r</tt>" or <em>g.remove</em>.
  17. <p>
  18. Grid cells in the MASK map containing <tt>0</tt> or <tt>NULL</tt>
  19. will replace data with NULL, while cells containing other values will allow
  20. data to pass through unaltered.
  21. <p>
  22. To restore raster operations to normal (i.e., all cells of the current region),
  23. remove the MASK file by setting the <b>-r</b> remove MASK flag. In this case, a
  24. dummy value must also be given for the input parameter.
  25. A MASK also can be removed by using <em>g.remove</em>
  26. or by renaming it to any other name with <em>g.rename</em>.
  27. <h2>NOTES</h2>
  28. The above method for specifying a "mask" may seem
  29. counterintuitive. Areas inside the MASK are not hidden;
  30. areas outside the MASK will be ignored until the MASK file
  31. is removed.
  32. <p>
  33. The MASK is read as an integer map. If MASK is actually a
  34. floating-point map, the values will be converted to integers using the
  35. map's quantisation rules (this defaults to round-to-nearest, but can
  36. be changed with r.quant).
  37. <p>
  38. <em>r.mask</em> uses <em>r.reclass</em> to create a reclassification of an
  39. existing raster map and name it <tt>MASK</tt>. A reclass map takes up less space, but
  40. is affected by any changes to the underlying map from which it was created.
  41. The user can select category values from the input raster to use in the MASK
  42. with the <em>maskcats</em> parameter; if <em>r.mask</em> is run from the
  43. command line, the category values listed in <em>maskcats</em> must be quoted
  44. (see example below).
  45. <p>
  46. Somewhat similar program functions to those performed by
  47. <em>r.mask</em> can be done using <em>r.mapcalc</em>,
  48. <em>g.region</em>, and other commands.
  49. <h2>EXAMPLES</h2>
  50. The examples are based on the North Carolina sample dataset.
  51. <p>
  52. Create a raster mask, for contraining the calculation of
  53. univariate statistics of the elevation values for "lakes":
  54. <div class="code"><pre>
  55. # set computation region to lakes raster map
  56. g.region raster=lakes -p
  57. # use lakes as MASK
  58. r.mask raster=lakes
  59. # get statistics for elevation pixels of lakes:
  60. r.univar elevation
  61. </pre></div>
  62. Remove the raster mask ("MASK" map) with the -r flag:
  63. <div class="code"><pre>
  64. r.mask -r
  65. </pre></div>
  66. Creating a mask from selected categories in the North Carolina
  67. 'geology_30m' raster map:
  68. <div class="code"><pre>
  69. g.region raster=geology_30m -p
  70. r.category geology_30m
  71. d.mon wx0
  72. d.rast geology_30m
  73. r.mask raster=geology_30m maskcats="217 thru 720"
  74. d.mon wx0
  75. d.rast geology_30m
  76. </pre></div>
  77. <h2>SEE ALSO</h2>
  78. <em>
  79. <a href="g.region.html">g.region</a>,
  80. <a href="r.mapcalc.html">r.mapcalc</a>,
  81. <a href="r.reclass.html">r.reclass</a>,
  82. <a href="g.remove.html">g.remove</a>,
  83. <a href="g.rename.html">g.rename</a>
  84. </em>
  85. <h2>AUTHOR</h2>
  86. Michael Barton, Arizona State University
  87. <p>
  88. <i>Last changed: $Date$</i>