+ (Unary Plus) operator

Mit der Spatial Analyst-Lizenz verfügbar.

Mit der Image Analyst-Lizenz verfügbar.

Zusammenfassung

Multiplies each cell value of the input raster on a cell-by-cell basis by 1.

Abbildung

Negate illustration
OutRas = + Raster("InRas1")

Diskussion

Bei Verwendung eines Operators mit einem Eingabe-Raster ist das Ergebnis ein Raster. Wenn jedoch alle Eingaben Zahlen sind, dann ist das Ergebnis ebenfalls eine Zahl.

Wenn in einem Ausdruck mehrere Operatoren verwendet werden, werden sie nicht zwingend von links nach rechts ausgeführt. Vielmehr wird der Operator mit dem höchsten Vorrangswert zuerst ausgeführt. Weitere Informationen finden Sie in der Tabelle zur Operator-Priorität unter Arbeiten mit Operatoren in Map Algebra. Sie können die Reihenfolge der Ausführung jedoch mithilfe von Klammern steuern.

If the input is integer, the output will contain integer values; if the input is floating point, the output will contain floating-point values.

Wenn die Eingabe ein Multiband-Raster ist, dann ist auch die Ausgabe ein Multiband-Raster. Der Operator führt den Vorgang für jedes Band in der Eingabe durch.

Wenn die Eingabe ein multidimensionales Raster ist, werden alle Ausschnitte sämtlicher Variablen verarbeitet, und die Ausgabe ist ein multidimensionales Raster.

Parameter

OperandErläuterungDatentyp
in_raster_or_constant

The input raster to apply the Unary Plus operator (multiply by 1).

Raster Layer | Constant

Codebeispiel

Unary + (Unary Plus) example 1 (Python window)

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")
Unary + (Unary Plus) example 2 (stand-alone script)

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")

Verwandte Themen