ee.Array.add

Aggiunge il primo valore al secondo in base agli elementi.

UtilizzoResi
Array.add(right)Array
ArgomentoTipoDettagli
questo: leftArrayIl valore a sinistra.
rightArrayIl valore a destra.

Esempi

Editor di codice (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]]

Configurazione di Python

Consulta la pagina Ambiente Python per informazioni sull'API Python e sull'utilizzo di geemap per lo sviluppo interattivo.

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]]