ee.Array.or
On an element-wise basis, returns 1 if and only if either input value is non-zero.
Usage | Returns |
---|
Array.or(right) | Array |
Argument | Type | Details |
---|
this: left | Array | The left-hand value. |
right | Array | The right-hand value. |
Examples
var empty = ee.Array([], ee.PixelType.int8());
print(empty.or(empty)); // []
print(ee.Array([0, 0, 1, 1]).or(ee.Array([0, 1, 0, 1]))); // [0,1,1,1]
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
empty = ee.Array([], ee.PixelType.int8())
display(empty.Or(empty)) # []
# [0, 1, 1, 1]
display(ee.Array([0, 0, 1, 1]).Or(ee.Array([0, 1, 0, 1])))
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-12-06 UTC.
[null,null,["Last updated 2023-12-06 UTC."],[[["The `or` operation compares two arrays element-wise and returns 1 if either corresponding element is non-zero, otherwise it returns 0."],["This method is useful for combining binary masks or identifying areas where either input array has a non-zero value."],["It is accessible in both JavaScript and Python environments of Google Earth Engine (GEE)."],["The result is a new array with the same dimensions as the input arrays, containing the element-wise `or` results."]]],["The `or` operation, applied element-wise between two arrays (`left` and `right`), returns a new array. Each element in the result is 1 if either the corresponding element in the `left` or `right` array is non-zero; otherwise, it's 0. `Array.or(right)` method takes a `right` array as an argument, while the `this` object refers to the `left` array. It's showed examples of usage in both Javascript and Python.\n"]]