ee.Array.eq Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The
Array.eqmethod performs element-wise equality comparison between two arrays.It returns 1 if the corresponding elements are equal and 0 otherwise.
The method handles different data types and floating-point comparisons, which can sometimes result in 0 even when values appear equal at first glance due to internal representation.
The method can be used with both JavaScript and Python implementations.
| Usage | Returns |
|---|---|
Array.eq(right) | Array |
| Argument | Type | Details |
|---|---|---|
this:left | Array | The left-hand value. |
right | Array | The right-hand value. |
Examples
Code Editor (JavaScript)
varempty=ee.Array([],ee.PixelType.int8());print(empty.eq(empty));// []print(ee.Array([0]).eq(ee.Array([1])));// 0print(ee.Array([0]).eq(ee.Array([0])));// 1print(ee.Array([1.1]).eq(ee.Array([1.1])));// 1print(ee.Array([1.1]).float().eq(ee.Array([1.1])));// 0print(ee.Array([1.1]).double().eq(ee.Array([1.1])));// 1print(ee.Array([1]).int8().eq(ee.Array([1])));// 1print(ee.Array([1]).int8().eq(ee.Array([1]).int32()));// 1
Python setup
See the Python Environment page for information on the Python API and usinggeemap for interactive development.
importeeimportgeemap.coreasgeemap
Colab (Python)
empty=ee.Array([],ee.PixelType.int8())display(empty.eq(empty))# []display(ee.Array([0]).eq(ee.Array([1])))# 0display(ee.Array([0]).eq(ee.Array([0])))# 1display(ee.Array([1.1]).eq(ee.Array([1.1])))# 1display(ee.Array([1.1]).float().eq(ee.Array([1.1])))# 0display(ee.Array([1.1]).double().eq(ee.Array([1.1])))# 1display(ee.Array([1]).int8().eq(ee.Array([1])))# 1display(ee.Array([1]).int8().eq(ee.Array([1]).int32()))# 1
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-12-06 UTC.