i have created a raster and saved it to a layer file. Now i want to change its symbology. Currently it has a "Stretch Colorizer" and i want to assign " ClassifyColorizer"
I am trying to implement the workflow without arcgispro and arcmap.
i came across this function of Update Colorizer which should change the colorizer but i am not sure if this will change all the properties. I am also not able to access the colorizer property with python scripting. I have attached the original colorizer proprty of the layer and the final property how it should look after changing updating classes and everything.
Is there a way to do that using Python/arcpy or any other libraries from python?
Here is how i create the layer
p=arcpy.md.MakeMultidimensionalRasterLayer(in_multidimensional_raster=netCDF_in, out_multidimensional_raster_layer=temperature,variables=["tmin"])
layer=p.getOutput(0)
k=arcpy.SaveToLayerFile_management(layer, "temperature.lyrx", "ABSOLUTE")
Here is the colorizer property of temperature.lyrx:
"colorizer" : {
"type" : "CIMRasterStretchColorizer",
"resamplingType" : "NearestNeighbor",
"noDataColor" : {
"type" : "CIMRGBColor",
"values" : [
255,
255,
255,
0
]
},
"backgroundColor" : {
"type" : "CIMRGBColor",
"values" : [
255,
255,
255,
0
]
},
"colorRamp" : {
"type" : "CIMMultipartColorRamp",
"colorRamps" : [
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "CIELAB"
},
"fromColor" : {
"type" : "CIMLABColor",
"values" : [
56.547017615341019,
76.899433471346256,
68.103444271380823,
100
]
},
"toColor" : {
"type" : "CIMLABColor",
"values" : [
96.683616491167115,
-20.419171018551619,
87.367929001284963,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "CIELAB"
},
"fromColor" : {
"type" : "CIMLABColor",
"values" : [
96.683616491167115,
-20.419171018551619,
87.367929001284963,
100
]
},
"toColor" : {
"type" : "CIMLABColor",
"values" : [
89.644590646826003,
-51.521697716782114,
-16.300660645455501,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "CIELAB"
},
"fromColor" : {
"type" : "CIMLABColor",
"values" : [
89.644590646826003,
-51.521697716782114,
-16.300660645455501,
100
]
},
"toColor" : {
"type" : "CIMLABColor",
"values" : [
34.668982832368499,
71.125560221348664,
-101.88789308244294,
100
]
}
}
],
"weights" : [
1,
1,
1
]
},
"colorScheme" : "Spectrum-Full Bright",
"customStretchMax" : 1,
"gammaValue" : 1,
"hillshadeZFactor" : 1,
"invert" : true,
"maxPercent" : 2,
"minPercent" : 2,
"standardDeviationParam" : 2,
"statsType" : "Dataset",
"stretchClasses" : [
{
"type" : "CIMRasterStretchClass",
"label" : "-59.0669",
"value" : -59.066879272460938
},
{
"type" : "CIMRasterStretchClass",
"value" : -15.690719604492188
},
{
"type" : "CIMRasterStretchClass",
"label" : "27.6854",
"value" : 27.685440063476563
}
],
"stretchStats" : {
"type" : "StatsHistogram",
"min" : -59.066879272460938,
"max" : 27.685440063476563,
"mean" : 0.58193869954082922,
"stddev" : 21.252553064504141,
"resolution" : 0.34020517386642157
},
"stretchType" : "MinimumMaximum"
}
Here is the property of updated file which was created through ArcGIS Pro but i want such file to be created through python/arcpy:
"colorizer" : {
"type" : "CIMRasterClassifyColorizer",
"resamplingType" : "NearestNeighbor",
"noDataColor" : {
"type" : "CIMRGBColor",
"values" : [
255,
255,
255,
0
]
},
"normalizationType" : "Nothing",
"classBreaks" : [
{
"type" : "CIMRasterClassBreak",
"upperBound" : -36.273132623410618,
"label" : "-59.0668 - -36.2731",
"color" : {
"type" : "CIMRGBColor",
"values" : [
165,
0,
38,
100
]
}
},
{
"type" : "CIMRasterClassBreak",
"upperBound" : -16.541232539158102,
"label" : "-36.273 - -16.5412",
"color" : {
"type" : "CIMRGBColor",
"values" : [
248.5,
141.5,
82,
100
]
}
},
{
"type" : "CIMRasterClassBreak",
"upperBound" : -1.2319997151691424,
"label" : "-16.5411 - -1.232",
"color" : {
"type" : "CIMRGBColor",
"values" : [
255,
255,
191,
100
]
}
},
{
"type" : "CIMRasterClassBreak",
"upperBound" : 13.737027934953399,
"label" : "-1.23199 - 13.737",
"color" : {
"type" : "CIMRGBColor",
"values" : [
143.5,
195,
221,
100
]
}
},
{
"type" : "CIMRasterClassBreak",
"upperBound" : 27.685440063476563,
"label" : "13.7371 - 27.6854",
"color" : {
"type" : "CIMRGBColor",
"values" : [
49,
54,
149,
100
]
}
}
],
"classificationMethod" : "NaturalBreaks",
"colorRamp" : {
"type" : "CIMMultipartColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"colorRamps" : [
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
165,
0,
38,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
215,
48,
39,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
215,
48,
39,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
244,
109,
67,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
244,
109,
67,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
253,
174,
97,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
253,
174,
97,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
254,
224,
144,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
254,
224,
144,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
255,
255,
191,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
255,
255,
191,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
224,
243,
248,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
224,
243,
248,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
171,
217,
233,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
171,
217,
233,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
116,
173,
209,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
116,
173,
209,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
69,
117,
180,
100
]
}
},
{
"type" : "CIMLinearContinuousColorRamp",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"fromColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
69,
117,
180,
100
]
},
"toColor" : {
"type" : "CIMRGBColor",
"colorSpace" : {
"type" : "CIMICCColorSpace",
"url" : "Default RGB"
},
"values" : [
49,
54,
149,
100
]
}
}
],
"weights" : [
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001,
0.10000000000000001
]
},
"field" : "Value",
"hillshadeZFactor" : 1,
"minimumBreak" : -59.066879272460938,
"showInAscendingOrder" : true,
"numberFormat" : {
"type" : "CIMNumericFormat",
"alignmentOption" : "esriAlignLeft",
"alignmentWidth" : 12,
"roundingOption" : "esriRoundNumberOfSignificantDigits",
"roundingValue" : 6,
"useSeparator" : true
}
}