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
ComputePansharpenWeights_management (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 pansharpened weights. If a raster product is used as the in_raster parameter, the band order within the raster product template will be used. | String |
Code sample
ComputePansharpenWeights example 1 (Python window)
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")
ComputePansharpenWeights example 2 (stand-alone script)
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)
ComputePansharpenWeights example 3 (workflow script)
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
This tool does not use any geoprocessing environments
Licensing information
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes
Related topics
- An overview of the Raster toolset
- Environment settings for raster data
- Create Pansharpened Raster Dataset
- Applying pan-sharpening to a raster layer in ArcMap
- Fundamentals of panchromatic sharpening
- Using the Pan-sharpen button on the Image Analysis window
- Exercise 7: Creating a pan-sharpened natural color mosaic dataset