> (Greater Than)

サマリ

Returns 1 for cells where the first raster is greater than the second raster and 0 for cells if it is not.

Greater Than (Relational) operator illustration
OutRas = Raster("InRas1") > 2

説明

The relational greater-than operation evaluates the first input value in relation to the second input value on a cell-by-cell basis within the Analysis window. In the relational evaluation, if the condition is true (the first input value is greater than the second input value), the output is 1; if it is false, the output is 0.

    Input1 > Input2, Output = 1
    Input1 = Input2, Output = 0
    Input1 < Input2, Output = 0

When one or both input values are NoData, the output is NoData.

ラスタ入力で演算子を使用すると、結果はラスタになります。ただし、すべての入力値が数字の場合、結果は数字になります。

複数の演算子が式に使用されている場合、それらは必ずしも左から右へという順に実行されるわけではありません。優先順位値が最も高い演算子が最初に実行されます。演算子の優先順位に関する詳細については、「演算子の優先順位のテーブル」をご参照ください。実行順序の制御には、括弧が使用できます。

ブール(~&^|)演算子には、関係(<<=>>===!=)演算子よりも高い優先度があります。したがって、ブール演算子が関係演算子と同じ式に使用されている場合、ブール演算子が最初に実行されます。実行の順序を変更するには、括弧を使用します。

複数の関係および(または)ブール演算子が 1 つの式で連続して使用されているときは、場合によっては実行されない可能性があります。このような問題を避けるために、式に適切な括弧を使用して、演算の実行順序を明示的に定義します。詳細については、「複雑なステートメントのルール」をご参照ください。

評価を実行するには、2 つの入力値が必要です。

この演算子では、入力の順序が結果に影響します。

出力値は、必ず整数になります。

構文

in_raster_or_constant1 > in_raster_or_constant2
オペランド説明データ タイプ
in_raster_or_constant1

The input being tested to determine if it is greater than the second input.

入力値の 1 つがラスタで、もう 1 つがスカラーである場合は、入力ラスタの各セルに実行される評価を持った出力ラスタが作成されます。

Raster Layer | Constant
in_raster_or_constant2

The input against which the first input is tested to be greater than.

入力値の 1 つがラスタで、もう 1 つがスカラーである場合は、入力ラスタの各セルに実行される評価を持った出力ラスタが作成されます。

Raster Layer | Constant

リターン

名前説明データ タイプ
out_raster

出力ラスタ オブジェクト。

Where cell values in the first input are greater than that of the second input, the output cell value will be 1. If the values of the first input are equal to or less than the second, the output value will be 0.

Raster

コードのサンプル

> (Greater Than) example 1 (Python window)

This sample performs a Greater Than operation on two input rasters.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outGreaterThan = Raster("degs") > Raster("negs")
outGreaterThan.save("C:/sapyexamples/output/outgt.img")
> (Greater Than) example 2 (stand-alone script)

This sample performs a Greater Than operation on two input rasters.

# Name: Op_GreaterThan_Ex_02.py
# Description: Performs a relational greater-than operation on two inputs
#              on a cell-by-cell basis within the Analysis window
# 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
inRaster1 = Raster("degs")
inRaster2 = Raster("negs")

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

# Execute GreaterThan
outGreaterThan = inRaster1 > inRaster2

# Save the output 
outGreaterThan.save("C:/sapyexamples/output/outgt")

環境

関連項目


7/10/2012