I am automating a series of maps in Arc 10.1 which involves looping through multiple dataframes replacing/updating layers. Updating the layers has worked fine except for one glitch- the symbology labels don't seem to transfer properly. I had created the layers previously and in some cases had manually changed the labels. For example, for raster where the values were classified as 0-5, 5-20, 20-50, 50-100, 100-167.3 the last range was relabelled ">100". However, when I run the following code the layer is added with the last class labelled 100-167.3 rather than >100. I've double checked all the layers and they have the proper labelling when added manually, just not when scripting with arcpy Do I need to include something to update the labels? Any thoughts would be appreciated!
for df in arcpy.mapping.ListDataFrames(myMXD):
#change layer
lyr2 = arcpy.mapping.ListLayers(myMXD,"",df)[9]
lyr2.replaceDataSource(r"C:\Rasters", "RASTER_WORKSPACE",r"output" + str(spn+1))
sourceLayer = arcpy.mapping.Layer(r"C:\Layers\output" + str(spn+1) +".lyr")
arcpy.mapping.UpdateLayer(df,lyr2,sourceLayer,True)
for df in arcpy.mapping.ListDataFrames(myMXD):
#change layer
lyr2 = arcpy.mapping.ListLayers(myMXD,"",df)[9]
lyr2.replaceDataSource(r"C:\Rasters", "RASTER_WORKSPACE",r"output" + str(spn+1))
sourceLayer = arcpy.mapping.Layer(r"C:\Layers\output" + str(spn+1) +".lyr")
arcpy.mapping.UpdateLayer(df,lyr2,sourceLayer,True)