Select to view content in your preferred language

Applying Symbology to layer through ArcPy script and values are getting changed?

1496
2
03-23-2017 10:27 PM
RishyaAgarwal
Deactivated User

I am doing a raster calculation over a hdf file and after that i have to apply symbology on it.When i am applying Symbology to the raster layer through script .its values get changed as compared to the values i am geting when i am doing it manually . Symbology Type : Stretched

script i am using is as ...

import arcpy from arcpy.sa
import *env.workspace = "E:\data"arcpy.CheckOutExtension("Spatial")
in_layer ="E:\data\filename.hdf"
#raster calculation 
output= floatdivide(in_layer,10000)
# applying symbology
 lyr ="output"symbolLyr = r"E:\data\Layer.lyr"
arcpy.ApplySymbologyFromLayer_management(lyr, symbolLyr)



Applying Script changes the topmost 3 values and changed it to the Min value ,Avg Value and Max Value , As Shown in Screen shot 1.. Max Value : 0.997 , Avg Value : 0.3985, Min Value :-0.2.
In Screen shot 2 we can see the first three values are changed.
we can see the first three values are changed.
Screenshot for Process by Arcpy Script

Screenshot for Manual Process


0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

ApplySymbologyFromLayer_management has an image showing what is dynamic and what to select if you don't want the range output altered.  Have you experimented with different options if the current representation isn't to your liking?

0 Kudos
RishyaAgarwal
Deactivated User

I am Using Stretched Symbology for Raster but Output Color ramp is showing different values if done by arcpy

Same If i import a layer file manually to raster its color ramp have different values .

Manually process resulting into Color ramp according to my liking bur arcpy method give some different output.
I searched out in above link but no solution for so is listed.

0 Kudos