Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
ee.Array.add
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Agrega el primer valor al segundo elemento por elemento.
Uso | Muestra |
---|
Array.add(right) | Array |
Argumento | Tipo | Detalles |
---|
esta: left | Array | Es el valor del lado izquierdo. |
right | Array | Es el valor del lado derecho. |
Ejemplos
Editor de código (JavaScript)
var empty = ee.Array([], ee.PixelType.int8());
print(empty.add(empty)); // []
print(ee.Array([0]).add(1)); // [1]
print(ee.Array([1]).add([2])); // [3]
print(ee.Array([-3]).add([-4])); // [-7]
print(ee.Array([5, 6]).add([7, 8])); // [12,14]
var array2x3 = ee.Array([[0, 1, 2], [3, 4, 5]]);
print(array2x3.add(1)); // [[1,2,3],[4,5,6]]
print(array2x3.add(array2x3)); // [[0,2,4],[6,8,10]]
Configuración de Python
Consulta la página
Entorno de Python para obtener información sobre la API de Python y el uso de geemap
para el desarrollo interactivo.
import ee
import geemap.core as geemap
Colab (Python)
empty = ee.Array([], ee.PixelType.int8())
display(empty.add(empty)) # []
display(ee.Array([0]).add(1)) # [1]
display(ee.Array([1]).add([2])) # [3]
display(ee.Array([-3]).add([-4])) # [-7]
display(ee.Array([5, 6]).add([7, 8])) # [12 ,14]
array2x3 = ee.Array([[0, 1, 2], [3, 4, 5]])
display(array2x3.add(1)) # [[1, 2 ,3], [4, 5, 6]]
display(array2x3.add(array2x3)) # [[0, 2, 4], [6, 8, 10]]
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (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```"]]