TfPower

Available with Spatial Analyst license.

Summary

Defines a Power transformation function which is determined from the shift and exponent 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

Discussion

The tool that uses the TfPower object is Rescale by Function.

The highest possible function value is limited to one-half of the maximum single-precision floating-point value (FLT_MAX, whose value is 3.402823466 x 1038), the value of which is 1.701411733 x 1038. Any input values that exceed this limit will receive the To scale value on the output raster.

Syntax

TfPower ({shift}, {exponent}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
ParameterExplanationData Type
shift

Defines how much each input value is to be shifted. The shift value is subtracted from the input value. The transformation function is applied to the shifted input value to determine the function value.

By default, the shift adjusts the function so it begins at the lowerThreshold (or very close). As a result, the function will be applied to 0 (the shifted input value) with the function being constrained between the lower and upper thresholds.

The shift can be positive or negative.

(The default value is None)

Double
exponent

The power to raise the input values in the transformation function. As the exponent increases, the preference for the larger input values increases more rapidly.

The exponent cannot equal 0 or 1.

(The default value is 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.

(The default value is 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.

(The default value is 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.

(The default value is 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.

(The default value is None)

Variant

Properties

PropertyExplanationData Type
shift
(Read and Write)

The value of the shift for the function which defines how much to subtract from each input value before applying the function.

Double
exponent
(Read and Write)

The value of the exponent to raise the input values in the transformation function.

Double
lowerThreshold
(Read and Write)

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
(Read and Write)

The value that will be assigned to the output cells whose input values are below the lowerThreshold.

Variant
upperThreshold
(Read and Write)

The value of the upperThreshold for the transformation function which defines the ending value at which to stop applying the specified function.

Double
valueAboveThreshold
(Read and Write)

The value that will be assigned to the output cells whose input values are above the upperThreshold.

Variant

Code sample

Transformation function Power example 1 (Python window)

Demonstrates how to create a TfPower 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("distroads", TfPower(-2, 0.27, "#", "#", "#", "#"), 1, 10)
outRescale.save("c:/sapyexamples/rescaletfpo1")
Transformation function Power example 2 (stand-alone script)

Demonstrates how to transform the input data with the RescaleByFunction tool using the TfPower class.

# Name: TfPower_Ex_02.py
# Description: Rescales input raster data using an Power 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 = "distroads"

# Create the TfPower object
shift = -2
exponent = 0.27
lowerthresh = "#"
valbelowthresh = "#"
upperthresh = "#"
valabovethresh = "#"
myTfFunction = TfPower(shift, exponent, lowerthresh, valbelowthresh, upperthresh, valabovethresh)

# Set evaluation scale
fromscale = 1
toscale = 10

# Execute RescaleByFunction
outRescale = RescaleByFunction(inRaster, myTfFunction, fromscale, toscale)

# Save the output
outRescale.save("c:/sapyexamples/rescaletfpo2")

Related topics