Using tool parameters
Tool parameters define how a tool will process input data. Tool parameters are composed of keywords, user-defined parameters, and classes.
Tool parameter rules
- A keyword parameter such as output_measurement has specific preset keywords (DEGREE, PERCENT_RISE), which are enclosed in quotes. Keywords are not case sensitive, but it is recommended that you
capitalize them for readability.
# Usage: Slope(in_raster, {output_measurement}, {z_factor}) # DEGREE will be used as the default output measurement in the # following statement outRas = Slope("elevation", "DEGREE")
User-defined parameters are inputs that generally quantify a parameter.
- User-defined parameters are generally numbers and are not quoted.
# In the following statement 4 is the zfactor parameter outRas = Slope("inraster", "DEGREE", 4)
Some input parameters are classes. Classes are used when geoprocessing tool parameters would otherwise be a more complicated string equivalent.
- The specific arguments for the class are enclosed in parentheses. String input is quoted, and numbers are not; parameters are comma delimited.
outRas = FocalStatistics("inraster", NbrAnnulus(1, 3, "MAP"))
For additional information, see An overview of Spatial Analyst classes.
- To specify a default value for an optional parameter, you must use empty quotes.
# In the following statement the slope calculations will # default to DEGREE; 4 is the z value factoroutRas = Slope("inraster", "", 4)
Hinweis:
For readability, it is recommended that you set the class object to a meaningfully named variable and use the variable in the Map Algebra tool.
myRemapVal = RemapValue([[-3,9],[0,1],[3,-4],[4,5],[5,6],[6,4],[7,-7]]) outReclassRV = Reclassify(inRaster, "VALUE", myRemapVal, "")
Verwandte Themen
7/10/2012