TfPower (arcpy.sa)

摘要

定义一个幂变换函数,该函数是根据平移和指数这两个形状控制参数,以及确定函数应用范围的阈值上限和下限确定的。

了解有关各参数对此变换函数作用的详细信息

讨论

使用 TfPower 对象的工具为按函数重设等级

可达的最高函数值限于最大单精度浮点值(FLT_MAX,值为 3.402823466 x 1038)的二分之一,即 1.701411733 x 1038。任何超出此限值的输入值都将在输出栅格中获得至等级的值。

语法

TfPower ({shift}, {exponent}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
参数说明数据类型
shift

定义每个输入值应平移的量。平移值是从输入值中减去的值。将变换函数应用于平移后的输入值以确定函数值。

默认情况下,通过平移进行调整,从而使函数从 lowerThreshold(或非常接近的位置)开始。因此,在函数已限于阈值下限和上限之间的情况下,函数将应用于 0(偏移后的输入值)。

The shift can be positive or negative.

(默认值为 None)

Double
exponent

在变换函数中提高输入值的幂。随着指数增加,较大输入值的优先级提升得更快。

The exponent cannot equal 0 or 1.

(默认值为 None)

Double
lowerThreshold

定义开始应用指定变换函数的起始值。在输出栅格上与 lowerThreshold 对应的输入值将分配到自等级评估等级值。低于 lowerThreshold 的输入值将分配到 valueBelowThreshold,并且不会计入函数值范围。

lowerThreshold 必须小于 upperThreshold

(默认值为 None)

Double
valueBelowThreshold

此用户定义的值用于分配输入值小于 lowerThreshold 的输出像元位置。

valueBelowThreshold 的值可以为浮点数、整数或 NoData。在工具对话框内,NoData 左右不使用引号;但在编写脚本时需要使用引号,即 "NoData"

(默认值为 None)

Variant
upperThreshold

定义终止应用指定变换函数的结束值。在输出栅格上与 upperThreshold 对应的输入值将分配到至等级评估等级值。高于 upperThreshold 的输入值将分配到 valueAboveThreshold,并且不会计入函数值范围。

lowerThreshold 必须小于 upperThreshold

(默认值为 None)

Double
valueAboveThreshold

此用户定义的值用于分配输入值大于 upperThreshold 的输出像元位置。

valueAboveThreshold 的值可以为浮点数、整数或 NoData。在工具对话框内,NoData 左右不使用引号;但在编写脚本时需要使用引号,即 "NoData"

(默认值为 None)

Variant

属性

属性说明数据类型
shift
(读写)

函数的平移值,用于定义在应用函数前每个输入值应减去的量。

Double
exponent
(读写)

在变换函数中用于增大输入值的指数值。

Double
lowerThreshold
(读写)

变换函数的 lowerThreshold 的值,用于定义开始应用指定变换函数的起始值。

Double
valueBelowThreshold
(读写)

输入值低于 lowerThreshold 的值将被分配到输出像元。

Variant
upperThreshold
(读写)

变换函数的 upperThreshold 值,用于定义停止应用指定函数的终止值。

Double
valueAboveThreshold
(读写)

输入值高于 upperThreshold 的值将被分配到输出像元。

Variant

代码实例

幂变换函数示例 1(Python 窗口)

演示如何创建 TfPower 类以及如何在 Python 窗口的 RescaleByFunction 工具中使用该类。

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")
幂变换函数示例 2(独立脚本)

演示如何通过 TfPower 类在 RescaleByFunction 工具中转换输入数据。

# 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

# 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/rescaletfpo2")

相关主题

5/10/2014