Rescale by Function (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Rescales the input raster values by applying a selected transformation function and then transforming the resulting values onto a specified continuous evaluation scale.

Learn more about how Rescale by Function works

Usage

Syntax

RescaleByFunction (in_raster, {transformation_function}, {from_scale}, {to_scale})
ParameterExplanationData Type
in_raster

The input raster to rescale.

Raster Layer
transformation_function
(Optional)

Specifies the continuous function to transform the input raster.

The transformation function classes are used to specify the type of transformation function.

The types of transformation function classes are

Which transformation function to use depends on which function best captures the interaction of the phenomenon's preference to the input values. To better understand how the lower and upper thresholds affect the output values, For more information on the parameters that control the thresholds, see The interaction of the lower and upper thresholds on the output values.

The following are the forms of the transformation function classes:

  • TfExponential({shift}, {baseFactor}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfGaussian({midpoint}, {spread}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfLarge({midpoint}, {spread}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfLinear({minimum}, {maximum}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfLogarithm({shift}, {factor}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfLogisticDecay({minimum}, {maximum}, {yInterceptPercent}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfLogisticGrowth({minimum}, {maximum}, {yInterceptPercent}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfMSLarge({meanMultiplier}, {STDMultiplier}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfMSSmall({meanMultiplier}, {STDMultiplier}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfNear({midpoint}, {spread}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfPower({shift}, {exponent}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfSmall({midpoint}, {spread}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})
  • TfSymmetricLinear({minimum}, {maximum}, {lowerThreshold}, {valueBelowThreshold}, {upperThreshold}, {valueAboveThreshold})

The default transformation function is TfMSSmall.

The parameter defaults for the transformation functions include the following:

  • baseFactor (for TfExponential) is derived from the input raster.
  • exponent (for TfPower) is derived from the input raster.
  • factor (for TfLogarithm) is derived from the input raster.
  • lowerThreshold (for all functions) is set to the Minimum of the input raster.
  • maximum (for TfLinear, TfLogisticDecay, TfLogisticGrowth, and TfSymmetricLinear) is set to the Maximum of the input raster.
  • meanMultiplier (for TfMSLarge and TfMSSmall) is 1.
  • midpoint (for TfGaussian and TfNear) is set to the midpoint of the value range of the input raster.
  • midpoint (for TfLarge and TfSmall) is set to the mean of the input raster.
  • minimum (for TfLinear, TfLogisticDecay, TfLogisticGrowth, and TfSymmetricLinear) is set to the Minimum of the input raster.
  • shift (for TfExponential, TfLogarithm, and TfPower) is derived from the input raster.
  • spread (for TfGaussian and TfNear) is derived from the input raster.
  • spread (for TfLarge and TfSmall) is 5.
  • STDMultiplier (for TfMSLarge and TFMSSmall) is 1.
  • upperThreshold (for all functions) is set to the Maximum of the input raster.
  • valueAboveThreshold (for all functions) is set to the to_scale value.
  • valueBelowThreshold (for all functions) is set to the from_scale value.
  • yInterceptPercent (for TfLogisticDecay) is 99.0000.
  • yInterceptPercent (for TfLogisticGrowth) is 1.0000.

Transformation function
from_scale
(Optional)

The starting value of the output evaluation scale.

The from_scale value cannot be equal to the to_scale value. The from_scale can be lower or higher than the to_scale (for example, from 1 to 10, or from 10 to 1).

The value must be positive and it can be either an integer or double.

The default is 1.

Double
to_scale
(Optional)

The ending value of the output evaluation scale.

The to_scale value cannot be equal to the from_scale value. The to_scale can be lower or higher than the from_scale (for example, from 1 to 10, or from 10 to 1).

The value must be positive and it can be either an integer or double.

The default is 10.

Double

Return Value

NameExplanationData Type
out_raster

The output rescaled raster.

The output will be a floating-point raster with values ranging from (or within) the from_scale and the to_scale evaluation values.

Raster

Code Sample

RescaleByFunction example 1 (Python window)

This example creates a raster whose values are rescaled using the MSSmall function.

import arcpy
from arcpy.sa import *
from arcpy import env
env.workspace = "c:/sapyexamples/data"
outRescale = RescaleByFunction("elevation", TfMSSmall(1.25, 1.5, "#", "#", 4000, "NoData"), 1, 10)
outRescale.save("c:/sapyexamples/rescaletfms1")
RescaleByFunction example 2 (stand-alone script)

Demonstrates the use of this tool on elevation data, where locations with lower elevations are much more preferred than higher elevations. Locations above 4,000 meters are set to NoData.

# Name: TfMSSmall_Ex_02.py
# Description: Rescales input raster data using a MSSmall function and
#     transforms the function values onto a specified evaluation scale. 
# Requirements: Spatial Analyst Extension
# Author: esri

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "elevation"

# Create the TfMSSmall object
meanmult = 1.25
stdmult = 1.5
lowerthresh = "#"
valbelowthresh = "10"
upperthresh = 4000
valabovethresh = "NoData"
myTfFunction = TfMSSmall(meanmult, stdmult, lowerthresh, valbelowthresh, upperthresh, valabovethresh)

# Set evaluation scale
fromscale = 1
toscale = 10

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute RescaleByFunction
outRescale = RescaleByFunction(inRaster, myTfFunction, fromscale, toscale)

# Save the output
outRescale.save("c:/sapyexamples/rescaletfms2")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
4/10/2014