Operand | Explanation | Data Type |
in_raster_or_constant | The input raster to apply the Unary Plus operator (multiply by 1). | Raster Layer | Constant |
Available with Spatial Analyst license.
Available with Image Analyst license.
Summary
Multiplies each cell value of the input raster on a cell-by-cell basis by 1.
Illustration
Discussion
When using an operator with a raster input, the result will be a raster. However, if all inputs are numbers, the result is a number.
When there are multiple operators in an expression, the operators are not necessarily run in left-to-right order. The operator with the highest precedence value will be run first. For more information, see the operator precedence table in Work with operators in map algebra. Use parentheses to control the run order.
If the input is integer, the output will contain integer values; if the input is floating point, the output will contain floating-point values.
If the input is a multiband raster, the output will be a multiband raster. The operator will perform the operation on each band in the input.
If the input is a multidimensional raster, all slices from all variables will be processed, and the output will be a multidimensional raster.
Parameters
Code sample
This sample applies the Unary Plus operator to the input raster.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outUnaryPlus = + Raster("degs")
outUnaryPlus.save("C:/sapyexamples/output/outdeg")
This sample applies the Unary Plus operator to the input raster.
# Name: Op_UnaryPlus_Ex_02.py
# Description: Returns the cell valuesof the input raster on a cell-by-cell
# basis.
# Requirements: Spatial Analyst Extension
# 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 = Raster("degs")
# Execute Negate
outUnaryPlus = +(inRaster)
# Save the output
outUnaryPlus.save("C:/sapyexamples/output/outunplus")