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.add()\u003c/code\u003e performs element-wise addition, adding the corresponding elements of two arrays or an array and a scalar.\u003c/p\u003e\n"],["\u003cp\u003eThe method returns a new array with the results of the addition.\u003c/p\u003e\n"],["\u003cp\u003eIt supports both single values and multi-dimensional arrays as input.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eArray.add()\u003c/code\u003e can be used with both server-side objects (like Images) and client-side objects (like Lists).\u003c/p\u003e\n"]]],["The `Array.add(right)` function performs element-wise addition between two arrays. The left-hand array is added to the right-hand array or value, returning a new array. It supports adding a scalar value to an array or adding two arrays of the same dimensions. Examples show how an empty array added to itself returns an empty array, single element arrays added to a scalar or array, as well as multi-element and multi-dimensional array addition.\n"],null,["# ee.Array.add\n\nOn an element-wise basis, adds the first value to the second.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------|---------|\n| Array.add`(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.add(empty)); // []\n\nprint(ee.Array([0]).add(1)); // [1]\nprint(ee.Array([1]).add([2])); // [3]\nprint(ee.Array([-3]).add([-4])); // [-7]\n\nprint(ee.Array([5, 6]).add([7, 8])); // [12,14]\n\nvar array2x3 = ee.Array([[0, 1, 2], [3, 4, 5]]);\nprint(array2x3.add(1)); // [[1,2,3],[4,5,6]]\nprint(array2x3.add(array2x3)); // [[0,2,4],[6,8,10]]\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.add(empty)) # []\n\ndisplay(ee.Array([0]).add(1)) # [1]\ndisplay(ee.Array([1]).add([2])) # [3]\ndisplay(ee.Array([-3]).add([-4])) # [-7]\n\ndisplay(ee.Array([5, 6]).add([7, 8])) # [12 ,14]\n\narray2x3 = ee.Array([[0, 1, 2], [3, 4, 5]])\ndisplay(array2x3.add(1)) # [[1, 2 ,3], [4, 5, 6]]\ndisplay(array2x3.add(array2x3)) # [[0, 2, 4], [6, 8, 10]]\n```"]]