Disponible con una licencia de Spatial Analyst.
Resumen
Defines a Linear transformation function which is determined from the minimum and maximum shape–controlling parameters as well as the lower and upper threshold that identify the range within which to apply the function.
Learn more about how the parameters affect this transformation function
Debate
The tool that uses the TfLinear object is Rescale by Function.
The function values range from 0 to 1, which are then transformed to the evaluation scale.
To create a positive slope for the transformation function, set the minimum value to be less than the maximum value. To create a negative slope for the function, set the minimum value to be larger than the maximum value.
The following relationships between the minimum and maximum parameters and the thresholds are important to understand:
- If the minimum parameter is set less than the maximum parameter and the minimum is greater than the lowerThreshold, any input value less than the minimum and greater than the lowerThreshold will receive the fromScale value on the output raster.
- If the maximum parameter is set greater than the minimum parameter and the maximum is less than the upperThreshold, any input value greater than the maximum and less than the upperThreshold will receive the toScale value on the output raster.
- If the minimum parameter is set less than the lowerThreshold, the minimum will be set to the lowerThreshold. If the maximum parameter is set greater than the upperThreshold, the maximum will be set to the upperThreshold.
The Linear function is useful when the smaller values linearly increase in preference to the larger values for a positive slope (resulting in the larger values receiving the higher output evaluation values) and opposite for a negative slope.
Sintaxis
TfLinear ({minimum}, {maximum}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
Parámetro | Explicación | Tipo de datos |
minimum |
One of two points the Linear transformation function must pass through. If the minimum value is less than the maximum, the linear function will have a positive slope. If the minimum value is greater than the maximum, the linear function will have a negative slope. The minimum cannot equal the maximum. (El valor predeterminado es None) | Double |
maximum | One of two points the Linear function must pass through. If the maximum value is greater than the minimum, the linear function will have a positive slope. If the maximum value is less than the minimum, the linear function will have a negative slope. The minimum cannot equal the maximum. (El valor predeterminado es None) | Double |
lowerThreshold | Defines the starting value at which to begin applying the specified transformation function. The input value corresponding to the lowerThreshold is assigned to the fromScale evaluation scale value on the output raster. Input values below the lowerThreshold are assigned to the valueBelowThreshold and are not considered in the function value range. The lowerThreshold must be less than the upperThreshold. (El valor predeterminado es None) | Double |
valueBelowThreshold | A user-specified value to assign output cell locations with input values below the lowerThreshold. The value for valueBelowThreshold can be float, integer, or NoData. In the tool dialog box, no quotation marks are used around NoData; however, quotation marks are required around "NoData" when scripting. (El valor predeterminado es None) | Variant |
upperThreshold | Defines the ending value at which to stop applying the specified transformation function. The input value corresponding to the upperThreshold is assigned to the toScale evaluation scale value on the output raster. Input values above the upperThreshold are assigned to the valueAboveThreshold and are not considered in the function value range. The lowerThreshold must be less than the upperThreshold. (El valor predeterminado es None) | Double |
valueAboveThreshold | A user-specified value to assign output cell locations with input values above the upperThreshold. The value for valueAboveThreshold can be float, integer, or NoData. In the tool dialog box, no quotation marks are used around NoData; however, quotation marks are required around "NoData" when scripting. (El valor predeterminado es None) | Variant |
Propiedades
Propiedad | Explicación | Tipo de datos |
minimum (Lectura y escritura) | The value of the minimum for the transformation function which defines one of the two points the Linear function must pass through. | Double |
maximum (Lectura y escritura) | The value of the maximum for the transformation function which defines one of the two points the Linear function must pass through. | Double |
lowerThreshold (Lectura y escritura) |
The value of the lowerThreshold for the transformation function which defines the starting value at which to begin applying the specified transformation function. | Double |
valueBelowThreshold (Lectura y escritura) |
The value that will be assigned to the output cells whose input values are below the lowerThreshold. | Variant |
upperThreshold (Lectura y escritura) |
The value of the upperThreshold for the transformation function which defines the ending value at which to stop applying the specified function. | Double |
valueAboveThreshold (Lectura y escritura) | The value that will be assigned to the output cells whose input values are above the upperThreshold. | Variant |
Ejemplo de código
Transformation function Linear example 1 (Python window)
Demonstrates how to create a TfLinear class and use it in the RescaleByFunction tool within the Python window.
import arcpy
from arcpy.sa import *
from arcpy import env
env.workspace = "c:/sapyexamples/data"
outRescale = RescaleByFunction("elevation", TfLinear(421, 4450, "#", "#", "#", "#"), 1, 10)
outRescale.save("c:/sapyexamples/rescaletfli1")
Transformation function Linear example 2 (stand-alone script)
Demonstrates how to transform the input data with the RescaleByFunction tool using the TfLinear class.
# Name: TfLinear_Ex_02.py
# Description: Rescales input raster data using a Linear function and
# transforms the function values onto a specified evaluation scale.
# Requirements: Spatial Analyst Extension
# Author: esri
# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "C:/sapyexamples/data"
# Set local variables
inRaster = "elevation"
# Create the TfLinear object
minimum = 421
maximum = 4450
lowerthresh = "#"
valbelowthresh = "#"
upperthresh = "#"
valabovethresh = "#"
myTfFunction = TfLinear(minimum, maximum, lowerthresh, valbelowthresh, upperthresh, valabovethresh)
# Set evaluation scale
fromscale = 1
toscale = 10
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute RescaleByFunction
outRescale = RescaleByFunction(inRaster, myTfFunction, fromscale, toscale)
# Save the output
outRescale.save("c:/sapyexamples/rescaletfli2")