RasterStretchColorizer

Resumen

Represents a raster stretch colorizer.

Debate

The raster stretch colorizer stretches values along a color ramp. The properties behave in a similar manner to the options exposed in the application. For example, changing the StretchType will control a subset of additional parameters that can be modified.

Propiedades

PropiedadExplicaciónTipo de datos
band
(Lectura y escritura)

An integer that represents a zero-based index matching the order of the bands the way they appear in the Symbology pane. The topmost band is index 0 and the bottommost is n-1.

Integer
colorRamp
(Lectura y escritura)

Provides access to the ColorRamp object.

ColorRamp
gamma
(Lectura y escritura)

A double that represents the gamma value.

Double
invertColorRamp
(Lectura y escritura)

A Boolean that reverses the color ramp's appearance.

Boolean
maxLabel
(Lectura y escritura)

A string that represents the raster stretch maximum label that appears in the Contents pane or legend.

String
maxPercent
(Lectura y escritura)

A double that represents the percentage of highest values to cut from the source data. This parameter is only applied if the StretchType is set to MinimumMaximum.

Double
minLabel
(Lectura y escritura)

A string that represents the raster stretch minimum label that appears in the Contents pane or legend.

String
minPercent
(Lectura y escritura)

A double that represents the percentage of lowest values to cut from the source data. This parameter is only applied if the StretchType is set to MinimumMaximum.

Double
standardDeviation
(Lectura y escritura)

A double that represents the standard deviation value. This parameter is only applied if the StretchType is set to StandardDeviation.

Double
stretchType
(Lectura y escritura)

A string that represents a valid stretching algorithm. The valid values are as follows:

  • CustomDisplay values with custom histogram.
  • EsriHighlight the contrast of moderate values while minimizing the impact of extreme high and low values.
  • HistogramEqualizeDisplay values with histogram equalize.
  • HistogramSpecificationDisplay values with histogram specification.
  • MinimumMaximumDisplay values between the actual minimum and maximum values.
  • NoneDisplay values between potential minimum and maximum.
  • PercentClipCut off percentages of highest and lowest values.
  • StandardDeviationDisplay values between a specified number of standard deviations.
String
type
(Sólo lectura)

Returns a string that represents the colorizer type.

String

Muestra de código

RasterStretchColorizer example

The following script first tests whether the layer's symbology supports a colorizer property, then confirms whether the renderer is a RasterStretchColorizer. Next,. it changes the stretchType to PercentClip and sets the appropriate min/max percents. Finally, it changes ColorRamp to a color ramp named Bathymetry #2.

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('RasterStretch')[0]

for l in m.listLayers():
  if l.isRasterLayer:
    sym = l.symbology
    if hasattr(sym, 'colorizer'):
      if sym.colorizer.type == 'RasterStretchColorizer':

        #Set StretchType = PercentClip
        if l.name == "Photo_SE":
          sym.colorizer.stretchType = "PercentClip"
          sym.colorizer.minPercent = 1.0
          sym.colorizer.maxPercent = 1.0
          cr = p.listColorRamps('Bathymetry #2')[0]
          sym.colorizer.colorRamp = cr
          sym.colorizer.invertColorRamp = True
          sym.colorizer.gamma = 2
          sym.colorizer.minLabel = "Min: " + sym.colorizer.minLabel
          sym.colorizer.maxLabel = "Max: " + sym.colorizer.maxLabel

          l.symbology = sym