.TH r.reclass 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBr.reclass\fR\fR - Reclassify raster map based on category values. .br Creates a new raster map whose category values are based upon a reclassification of the categories in an existing raster map. .SH KEYWORDS raster, reclassification .SH SYNOPSIS \fBr.reclass\fR .br \fBr.reclass help\fR .br \fBr.reclass input\fR=\fIname\fR \fBoutput\fR=\fIname\fR [\fBrules\fR=\fIname\fR] [\fBtitle\fR=\fIstring\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIname\fR" 4m .br Raster map to be reclassified .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output raster map .IP "\fBrules\fR=\fIname\fR" 4m .br File containing reclass rules .br \(dq-" to read from stdin .IP "\fBtitle\fR=\fIstring\fR" 4m .br Title for the resulting raster map .PP .SH DESCRIPTION \fIr.reclass\fR creates an \fIoutput\fR map layer based on an \fIinput\fR integer raster map layer. The output map layer will be a reclassification of the input map layer based on reclass rules input to \fIr.reclass\fR, and can be treated in much the same way that raster maps are treated. A \fITITLE\fR for the output map layer may be (optionally) specified by the user. .PP The reclass rules are read from standard input (i.e., from the keyboard, redirected from a file, or piped through another program). .PP Before using \fIr.reclass\fR the user must know the following: ..IP .IP \fB1\fR The new categories desired; and, which old categories fit into which new categories. .IP \fB2\fR The names of the new categories. .PP .SH NOTES In fact, the \fIr.reclass\fR program does \fInot\fR generate any new raster map layers (in the interests of disk space conservation). Instead, a \fBreclass table\fR is stored which will be used to reclassify the original raster map layer each time the new (reclassed) map name is requested. As far as the user (and programmer) is concerned, that raster map has been created. .PP \fIr.reclass\fR only works on an \fIinteger\fR input raster map; if the input map is instead floating point data, you must multiply the input data by some factor to acheive whole number input data, otherwise \fIr.reclass\fR will round the raster values down to the next integer. .PP Also note that although the user can generate a \fIr.reclass\fR map which is based on another \fIr.reclass\fR map, the new \fIr.reclass\fR map map will be stored in GRASS as a reclass of the \fIoriginal\fR raster map on which the first reclassed map was based. Therefore, while GRASS allows the user to provide \fIr.reclass\fR map layer information which is based on an already reclassified map (for the user's convenience), no \fIr.reclass\fR map layer (i.e., \fIreclass table\fR) will ever be \fIstored\fR as a \fIr.reclass\fR of a \fIr.reclass\fR. .PP To convert a reclass map to a regular raster map layer, set your geographic region settings to match the settings in the header for the reclass map (with "g.region rast=reclass_map", or viewable by running \fIr.info\fR) and then run \fIr.resample\fR. .PP \fIr.mapcalc\fR can be used to convert a reclass map to a regular raster map layer as well: \fC .DS .br r.mapcalc "raster_map = reclass_map" .br .DE \fR .PP where \fIraster_map\fR is the name to be given to the new raster map, and \fIreclass_map\fR is an existing reclass map. .PP Because \fIr.reclass\fR generates a table referencing some original raster map layer rather than creating a reclassed raster map layer, a \fIr.reclass\fR map layer will no longer be accessible if the original raster map layer upon which it was based is later removed. .PP A \fIr.reclass\fR map is not a true raster map layer. Rather, it is a table of reclassification values which reference the input raster map layer. Therefore, users who wish to retain reclassified map layers must also save the original input raster map layers from which they were generated. Alternatively r.recode can be used. .PP Category values which are not explicitly reclassified to a new value by the user will be reclassified to NULL. .SS Reclass Rules Each line of input must have the following format: .br \fBinput_categories=\fR\fIoutput_category \fR[\fIlabel\fR] .PP .PP where each line of input specifies the category values in the input raster map layer to be reclassified to the new \fIoutput_category\fR category value. Specification of a \fIlabel\fR to be associated with the new output map layer category is optional. If specified, it is recorded as the category label for the new category value. The equal sign = is required. The \fIinput_category(ies)\fR may consist of single category values or a range of such values in the format "\fIlow\fR thru \fIhigh\fR." The word "thru" must be present. .PP To include all (remaining) values the asterix "*" can be used. This rule has to be set as last rule. No further rules are accepted after setting this rule. The special rule "* = *" specifies that all categories not expicitly set by one of the above rules should be passed through unaltered instead of being set to NULL. .PP Categories to become no data are specified by setting the output category value to "NULL". .PP A line containing only the word \fBend\fR terminates the input. .SH EXAMPLES The following examples may help clarify the reclass rules. .PP .IP " .br 1. This example reclassifies categories 1, 2 and 3 in the input raster map layer "roads" to category 1 with category label "good quality" in the output map layer, and reclassifies input raster map layer categories 4 and 5 to category 2 with the label "poor quality" in the output map layer. \fC .DS .br 1 2 3 = 1 good quality .br 4 5 = 2 poor quality .br .DE \fR .PP .br 2. This example reclassifies categories 1, 3 and 5 in the input raster map layer to category 1 with category label "poor quality" in the output map layer, and reclassifies input raster map layer categories 2, 4, and 6 to category 2 with the label "good quality" in the output map layer. All other values are reclassified to NULL. \fC .DS .br 1 3 5 = 1 poor quality .br 2 4 6 = 2 good quality .br * = NULL .br .DE \fR .PP .br 3. This example reclassifies input raster map layer categories 1 thru 10 to output map layer category 1, input map layer categories 11 thru 20 to output map layer category 2, and input map layer categories 21 thru 30 to output map layer category 3, all without labels. The range from 30 to 40 is reclassified as NULL. \fC .DS .br 1 thru 10 = 1 .br 11 thru 20 = 2 .br 21 thru 30 = 3 .br 30 thru 40 = NULL .br .DE \fR .PP .br 4. Subsequent rules override previous rules. Therefore, the below example reclassifies input raster map layer categories 1 thru 19 and 51 thru 100 to category 1 in the output map layer, input raster map layer categories 20 thru 24 and 26 thru 50 to the output map layer category 2, and input raster map layer category 25 to the output category 3. \fC .DS .br 1 thru 100 = 1 poor quality .br 20 thru 50 = 2 medium quality .br 25 = 3 good quality .br .DE \fR .PP .br 5. The previous example could also have been entered as: \fC .DS .br 1 thru 19 51 thru 100 = 1 poor quality .br 20 thru 24 26 thru 50 = 2 medium quality .br 25 = 3 good quality .br .DE \fR or as: \fC .DS .br 1 thru 19 = 1 poor quality .br 51 thru 100 = 1 .br 20 thru 24 = 2 .br 26 thru 50 = 2 medium quality .br 25 = 3 good quality .br .DE \fR .PP .PP The final example was given to show how the labels are handled. If a new category value appears in more than one rule (as is the case with new category values 1 and 2), the last label which was specified becomes the label for that category. In this case the labels are assigned exactly as in the two previous examples. .SH SEE ALSO \fIr.resample\fR, \fIr.rescale\fR, \fIr.recode\fR .SH AUTHORS James Westervelt, .br Michael Shapiro .br U.S.Army Construction Engineering Research Laboratory .PP \fILast changed: $Date: 2009-09-19 17:10:59 +0200 (Sat, 19 Sep 2009) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team