# 计算全色锐化权重 (Data Management)

## 用法

• 此工具将计算一组最佳的全色锐化权重，这些值可用于需要全色锐化权重的其他工具。

• 如果将栅格产品用作输入栅格，则采用栅格产品模板中的波段顺序。

## 语法

ComputePansharpenWeights_management (in_raster, in_panchromatic_image, {band_indexes})
 参数 说明 数据类型 in_raster 输入多光谱栅格。 Mosaic Dataset; Mosaic Layer; Raster Dataset; Raster Layer in_panchromatic_image 输入全色栅格。 Raster Layer band_indexes(可选) 全色锐化权重的波段顺序。 如果将栅格产品用作 in_raster 参数，则使用栅格产品模板中的波段顺序。 String

## 代码实例

``````import arcpy
arcpy.ComputePansharpenWeights_management(
"c:/data/rgb.tif", "c:/data/image.tif", "3 2 1 4")
``````

``````#Run Compute Pan Sharpen Weights tool using the bands 4,3,2,1

import arcpy

InMSraster = "C:\\Landsat7\\L71046029_02920050705_MTL.txt\Multispectral"
InPANraster = "C:\\Landsat7\\L71046029_02920050705_MTL.txt\Panchromatic"
band_index = "3 2 1 5"

arcpy.ComputePansharpenWeights_management(InMSraster, InPANraster, band_index)
``````

``````#Compute the pansharpening weights and use the results in the
#create pansharpening tool.

try:
import arcpy

InRGBraster = "C:\\temp\\rgb.img"
InPanraster = "C:\\temp\\pan.tif"

#Compute Pan Sharpen Weights
out_pan_weight = arcpy.ComputePansharpenWeights_management(
InRGBraster, InPanraster, "3 2 1 4")

#Get results
pansharpen_weights = out_pan_weight.getOutput(0)

#Split the results string for weights of each band
pansplit = pansharpen_weights.split(";")

#Run the Create pan sharpened raster dataset tool.
arcpy.CreatePansharpenedRasterDataset_management(
InRGBraster, "3", "2", "1", "4", "C:\\temp\\pansharpened_raster.tif",
InPanraster, "Gram-Schmidt", pansplit[0].split(" ")[1],
pansplit[1].split(" ")[1], pansplit[2].split(" ")[1],
pansplit[3].split(" ")[1])

except arcpy.ExecuteError:
print(arcpy.GetMessages())
except Exception as err:
print(err[0])
``````

## 许可信息

ArcGIS for Desktop Basic: 是
ArcGIS for Desktop Standard: 是