Description
This tool provides a mechanism for automatically issuing a series of selection statements, and populating a field with values based on those statements. The selection statements are formulated in exactly the same way as in the 'Select by attributes' tool in ArcMap (SQL-style statements based on field names and values). The benefit of this command is that a set of selection statements can be issued automatically, a field can be automatically populated with values, and this procedure can be conveniently applied to many datasets.
The input is a table or feature data source, and the output is stored in a new or existing field. By default the output field type is the long integer type and the recode values must therefore be integers. However, you can change this to either double or string field types to accomodate other recode values (real numbers or text respectively). If you specify an existing field you must also authorize the tool to overwrite data in this field using the 'update=TRUE' option.
The selection statements are stored in a separate text file (e.g. one that you have created with Notepad). This text file should have no header line, and should have one statement per line. The syntax of the selection statement is exactly as it would appear in the 'Select by attributes' tool in ArcMap. An R style assignment operator (->) is used to define what value is assigned to the records that are selected by a statement. For instance, given a field name called PrSuitHab, which contains real numbers ranging from 0-1, the following three lines would result in all records being classified as either 1, 2 or 3.
"PrSuitHab" <= 0.2 -> 1
"PrSuitHab" > 0.2 AND "PrSuitHab" <= 0.7 -> 2
"PrSuitHab" > 0.7 AND "PrSuitHab" <= 1 -> 3
If you have specified a string output field then you must specify the recode value using double quotes:
"PrSuitHab" <= 0.2 -> "A"
Syntax
reclassifyrecords(in, file, field, [fieldtype], [update]);
| in | the input table or feature data source | |
| file | the file containing the reclassification instructions - see the full help documentation for details | |
| field | the new field that will contain the reclassification values | |
| [fieldtype] | the type of the new field: LONG=long integer (default), DOUBLE=double precision, STRING=string | |
| [update] | (TRUE/FALSE) if TRUE and you specify an existing field, the existing field will be updated rather than generating an error message (default=FALSE); warning: this option will result in overwriting of existing data and is therefore potentially dangerous. |
Example
reclassifyrecords(in="C:\data\landcov", file="C:\data\lcrecode1.csv", out="C:\data\newlc");
reclassifyrecords(in="C:\data\dem.img", file="C:\data\recodedem.csv", out="C:\data\elev");