Summary
Calculates an optimal set of pan sharpened weights for new or custom sensor data.
Usage
This tool will calculate an optimal set of pan sharpened weights, which can be used in other tools that require pan sharpened weights.
If a raster product is used as the Input Raster, the band order within the raster product template will be honored.
Syntax
arcpy.management.ComputePansharpenWeights(in_raster, in_panchromatic_image, {band_indexes})
Parameter | Explanation | Data Type |
in_raster | A multispectral raster that has a panchromatic band. | Mosaic Dataset; Mosaic Layer; Raster Dataset; Raster Layer |
in_panchromatic_image | The panchromatic band associated with the multispectral raster. | Raster Layer |
band_indexes (Optional) | The band order for the pan sharpened weights. If a raster product is used as the in_raster parameter, the band order within the raster product template will be used. | String |
Derived Output
Name | Explanation | Data Type |
out_string | The output pan sharpened weights. | String |
Code sample
This is a Python sample for the ComputePansharpenWeights tool.
import arcpy
arcpy.ComputePansharpenWeights_management(
"c:/data/rgb.tif", "c:/data/image.tif", "3 2 1 4")
This is a Python script sample for the ComputePansharpenWeights tool.
#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)
This is a Python script sample to use the ComputePansharpenWeights output in another tool.
#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])
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes