ee.Array.max
On an element-wise basis, selects the maximum of the first and second values.
Usage | Returns |
---|
Array.max(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.max(empty)); // []
var array1 = ee.Array([0, -3, 5, 3]);
var array2 = ee.Array([0, -1, 2, 4]);
print(array1.max(array2)); // [0,-1,5,4]
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.max(empty)) # []
array1 = ee.Array([0, -3, 5, 3])
array2 = ee.Array([0, -1, 2, 4])
display(array1.max(array2)) # [0, -1, 5, 4]
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-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`Array.max()` is an element-wise function that returns an array containing the maximum values between two input arrays."],["The function compares corresponding elements in the 'left' (this) and 'right' input arrays."],["If both input arrays are empty, an empty array is returned."],["The resulting array has the same dimensions as the input arrays, with each element representing the maximum between corresponding elements of the inputs."]]],["The `Array.max(right)` function compares two arrays (`left` and `right`) element-wise. For each corresponding pair of elements, it selects the maximum value. It returns a new array containing these maximum values. Both input arrays must be of the same length. Example show that using this method with `[0, -3, 5, 3]` and `[0, -1, 2, 4]` will result in `[0, -1, 5, 4]` . An empty array compared to an empty array will also result in an empty array.\n"]]