Anúncio: todos os projetos não comerciais registrados para usar o Earth Engine antes de
15 de abril de 2025 precisam
verificar a qualificação não comercial para manter o acesso. Se você não fizer a verificação até 26 de setembro de 2025, seu acesso poderá ser suspenso.
ee.Array.and
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Retorna 1 elemento por elemento se e somente se os dois valores forem diferentes de zero.
| Uso | Retorna |
|---|
Array.and(right) | Matriz |
| Argumento | Tipo | Detalhes |
|---|
isso: left | Matriz | O valor à esquerda. |
right | Matriz | O valor à direita. |
Exemplos
Editor de código (JavaScript)
// Element-wise boolean "and" operator.
// Both arrays must be the same dimensions.
var arrayNeither = ee.Array([0, 0]);
var arrayFirst = ee.Array([1, 0]);
var arraySecond = ee.Array([0, 1]);
var arrayBoth = ee.Array([1, 1]);
// Any non-zero value is true.
var arrayLarger = ee.Array([-2, 2]);
print(arrayBoth.and(arrayLarger)); // [1, 1]
print(arrayBoth.and(arrayNeither)); // [0, 0]
print(arrayFirst.and(arraySecond)); // [0, 0]
print(arraySecond.and(arrayFirst)); // [0, 0]
print(arrayBoth.and(arrayFirst)); // [1, 0]
print(arrayBoth.and(arraySecond)); // [0, 1]
print(arrayNeither.and(arrayFirst)); // [0, 0]
print(arrayNeither.and(arraySecond)); // [0, 0]
// Works the same for all PixelTypes.
var arrayDouble = ee.Array([0.0, 2.0], ee.PixelType.double());
print(arrayBoth.and(arrayDouble)); // [0, 1]
Configuração do Python
Consulte a página
Ambiente Python para informações sobre a API Python e como usar
geemap para desenvolvimento interativo.
import ee
import geemap.core as geemap
Colab (Python)
# Element-wise boolean "and" operator.
# Both arrays must be the same dimensions.
array_neither = ee.Array([0, 0])
array_first = ee.Array([1, 0])
array_second = ee.Array([0, 1])
array_both = ee.Array([1, 1])
# Any non-zero value is true.
array_larger = ee.Array([-2, 2])
display(array_both.And(array_larger)) # [1, 1]
display(array_both.And(array_neither)) # [0, 0]
display(array_first.And(array_second)) # [0, 0]
display(array_second.And(array_first)) # [0, 0]
display(array_both.And(array_first)) # [1, 0]
display(array_both.And(array_second)) # [0, 1]
display(array_neither.And(array_first)) # [0, 0]
display(array_neither.And(array_second)) # [0, 0]
# Works the same for all PixelTypes.
array_double = ee.Array([0.0, 2.0], ee.PixelType.double())
display(array_both.And(array_double)) # [0, 1]
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[],[]]