Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003e\u003ccode\u003eArray.max()\u003c/code\u003e is an element-wise function that returns an array containing the maximum values between two input arrays.\u003c/p\u003e\n"],["\u003cp\u003eThe function compares corresponding elements in the 'left' (this) and 'right' input arrays.\u003c/p\u003e\n"],["\u003cp\u003eIf both input arrays are empty, an empty array is returned.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting array has the same dimensions as the input arrays, with each element representing the maximum between corresponding elements of the inputs.\u003c/p\u003e\n"]]],["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"],null,["# ee.Array.max\n\nOn an element-wise basis, selects the maximum of the first and second values.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------|---------|\n| Array.max`(right)` | Array |\n\n| Argument | Type | Details |\n|--------------|-------|-----------------------|\n| this: `left` | Array | The left-hand value. |\n| `right` | Array | The right-hand value. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nvar empty = ee.Array([], ee.PixelType.int8());\nprint(empty.max(empty)); // []\n\nvar array1 = ee.Array([0, -3, 5, 3]);\nvar array2 = ee.Array([0, -1, 2, 4]);\nprint(array1.max(array2)); // [0,-1,5,4]\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\nempty = ee.Array([], ee.PixelType.int8())\ndisplay(empty.max(empty)) # []\n\narray1 = ee.Array([0, -3, 5, 3])\narray2 = ee.Array([0, -1, 2, 4])\ndisplay(array1.max(array2)) # [0, -1, 5, 4]\n```"]]