<= (Relational Less Than Equal To) operator

Spatial Analyst のライセンスで利用可能。

Image Analyst ライセンスで利用できます。

概要

Returns 1 for cells where the first raster is less than or equal to the second raster and 0 where it is not.

Less Than or Equal To (Relational) operator illustration
OutRas = Raster("InRas1") <= 2

ディスカッション

The relational less-than-or-equal-to 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 less than or equal to the second input value), the output is 1; if it is false, the output is 0.

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

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

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

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

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

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

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

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

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

両方の入力がシングル バンド ラスターの場合、または入力の片方が定数の場合は、出力はシングル バンド ラスターになります。

両方の入力がマルチバンド ラスターの場合、または入力の片方が定数の場合は、出力はマルチバンド ラスターになります。それぞれのマルチバンド入力で、バンドの数は同一の必要があります。

演算子は、1 つの入力に含まれる各バンドについて、他の入力に含まれる対応バンドに対して演算を実行します。入力の 1 つがマルチバンド ラスターで、もう 1 つの入力が定数の場合、演算子はマルチバンド入力に含まれる各バンドについて、定数値との演算を実行します。

構文

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

The input being tested to determine if it is less than or equal to the second input.

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

Raster Layer | Constant
in_raster_or_constant2

The input against which the first input is tested to be less than or equal to.

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

Raster Layer | Constant

戻り値

名前説明データ タイプ
out_raster

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

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

Raster

コードのサンプル

<= (Less Than Equal To) example 1 (Python window)

This sample performs a Less Than Equal To operation on two input rasters.

import arcpy
from arcpy import env
from arcpy.ia import *
env.workspace = "C:/iapyexamples/data"
outLTE = Raster("degs") <= Raster("negs")
outLTE.save("C:/iapyexamples/output/outlte.img")
<= (Less Than Equal To) example 2 (stand-alone script)

This sample performs a Less Than Equal To operation on two input rasters.

# Name: Op_LessThanEqual_Ex_02.py
# Description: Performs a relational less-than-equal operation on two
#              inputs on a cell-by-cell basis
# Requirements: Image Analyst Extension

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

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

# Set local variables
inRaster1 = Raster("degs")
inRaster2 = Raster("negs")

# Execute LessThanEqual
outLTE = inRaster1 <= inRaster2

# Save the output 
outLTE.save("C:/iapyexamples/output/outlte")

関連トピック