r.recode.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <h2>DESCRIPTION</h2>
  2. <em>r.recode</em> creates an output raster map by recoding input
  3. raster map based on recode <b>rules</b>. A <b>title</b> for the output
  4. raster map may be (optionally) specified by the user.
  5. <p>The recode rules can be read from standard input (i.e., from the
  6. keyboard, redirected from a file, or piped through another program) by
  7. entering <b>rules=-</b>.
  8. <p>Rules are defined in one of these formats:
  9. <div class="code"><pre>
  10. old_low:old_high:new_low:new_high
  11. old_low:old_high:new_val (i.e. new_high == new_low)
  12. *:old_val:new_val (interval [inf, old_val])
  13. old_val:*:new_val (interval [old_val, inf])
  14. </pre></div>
  15. <p><em>r.recode</em> is loosely based
  16. on <em><a href="r.reclass.html">r.reclass</a></em> and uses the GRASS
  17. Reclass Library to convert the rasters. It has routines for converting
  18. to every possible combination of raster (eg. CELL to DCELL, DCELL to
  19. FCELL, etc). Standard floating point raster precision is float
  20. (FCELL), with <b>-d</b> double precision (DCELL) will be written.
  21. <p>There are four basic routines that it accepts:
  22. <ol>
  23. <li>old-low to old-high is reclassed to new-low to new high , where the
  24. user provides all four values. The program figures on the fly what type of
  25. raster should be created.
  26. <li>old-low to old-high is reclassed to a single new value. Anything outside
  27. the range is null.
  28. <li> * to old-high will reclass everything less than old-high to a single
  29. new value.
  30. <li> old-low to * will reclass everything greater than old-low to a single
  31. new value.
  32. </ol>
  33. These four sets of arguments can be given on the command line, or
  34. piped via stdin or a file. More than one set of arguments is accepted.
  35. <h2>EXAMPLES</h2>
  36. <h3>Map type conversion</h3>
  37. To simply convert a raster between formats (eg. int to float) the user
  38. would use the first argument. For example
  39. <div class="code"><pre>
  40. 10:1500:0.1:15.0
  41. </pre></div>
  42. would convert an input raster map with range between 10 and 1500 to a
  43. float raster raster with range bewteen 0.1 and 15.0.
  44. <h3>Value replacement</h3>
  45. <em>r.recode</em> can be used to replace existing cell values by
  46. others. The formatting is as described above. In following example the
  47. values 1, 2 and 3 are replaced by 1.1, 7.5 resp. 0.4:
  48. <div class="code"><pre>
  49. r.recode input=oldmap output=newmap rules=- &lt;&lt; EOF
  50. 1:1:1.1:1.1
  51. 2:2:7.5:7.5
  52. 3:3:0.4:0.4
  53. EOF
  54. </pre></div>
  55. <h2>AUTHOR</h2>
  56. CERL
  57. <p><i>Last changed: $Date$</i>