r.mask.html 3.3 KB

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