Annuncio: tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso a Earth Engine.
ee.Array.argmax
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Restituisce la posizione, come elenco di indici in ogni asse dell'array, del valore massimo in un array o null se l'array è vuoto. Se sono presenti più occorrenze del valore massimo, restituisce la posizione della prima.
Utilizzo | Resi |
---|
Array.argmax() | Elenco |
Argomento | Tipo | Dettagli |
---|
questo: array | Array | |
Esempi
Editor di codice (JavaScript)
// Return the position of the maximum value in each dimension.
// Returns null if the array is empty.
print(ee.Array([], ee.PixelType.int8()).argmax()); // null
print(ee.Array([9]).argmax()); // [0]
print(ee.Array([0, -1, 2, 1]).argmax()); // [2]
print(ee.Array([[3, 4, 2], [6, 5, 7]]).argmax()); // [1, 2]
// Returns the first occurrence of the maximum.
print(ee.Array([1, 1, 1, 9, 9, 9]).argmax()); // [3]
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)
# Return the position of the maximum value in each dimension.
# Returns null if the array is empty.
display(ee.Array([], ee.PixelType.int8()).argmax()) # None
display(ee.Array([9]).argmax()) # [0]
display(ee.Array([0, -1, 2, 1]).argmax()) # [2]
display(ee.Array([[3, 4, 2], [6, 5, 7]]).argmax()) # [1, 2]
# Returns the first occurrence of the maximum.
display(ee.Array([1, 1, 1, 9, 9, 9]).argmax()) # [3]
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[null,null,["Ultimo aggiornamento 2025-07-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eArray.argmax()\u003c/code\u003e returns the position of the maximum value within an array as a list of indices.\u003c/p\u003e\n"],["\u003cp\u003eIf multiple maximum values exist, the function returns the position of the first occurrence.\u003c/p\u003e\n"],["\u003cp\u003eAn empty array input results in a \u003ccode\u003enull\u003c/code\u003e (JavaScript) or \u003ccode\u003eNone\u003c/code\u003e (Python) output.\u003c/p\u003e\n"],["\u003cp\u003eThe function operates across all dimensions of the input array.\u003c/p\u003e\n"]]],["The `argmax()` function finds the position of the maximum value within an array. It returns a list of indices, representing the location in each array dimension. If the array is empty, it returns null. In cases of multiple maximum values, it returns the index of the first occurrence. Usage is `Array.argmax()`, and it takes one array argument. Examples illustrate its behavior with empty, single-value, multi-value, and multi-dimensional arrays.\n"],null,["# ee.Array.argmax\n\nReturns the position, as a list of indices in each array axis, of the maximum value in an array, or null if the array is empty. If there are multiple occurrences of the maximum, returns the position of the first.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------|---------|\n| Array.argmax`()` | List |\n\n| Argument | Type | Details |\n|---------------|-------|---------|\n| this: `array` | Array | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Return the position of the maximum value in each dimension.\n\n// Returns null if the array is empty.\nprint(ee.Array([], ee.PixelType.int8()).argmax()); // null\n\nprint(ee.Array([9]).argmax()); // [0]\nprint(ee.Array([0, -1, 2, 1]).argmax()); // [2]\nprint(ee.Array([[3, 4, 2], [6, 5, 7]]).argmax()); // [1, 2]\n\n// Returns the first occurrence of the maximum.\nprint(ee.Array([1, 1, 1, 9, 9, 9]).argmax()); // [3]\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\n# Return the position of the maximum value in each dimension.\n\n# Returns null if the array is empty.\ndisplay(ee.Array([], ee.PixelType.int8()).argmax()) # None\n\ndisplay(ee.Array([9]).argmax()) # [0]\ndisplay(ee.Array([0, -1, 2, 1]).argmax()) # [2]\ndisplay(ee.Array([[3, 4, 2], [6, 5, 7]]).argmax()) # [1, 2]\n\n# Returns the first occurrence of the maximum.\ndisplay(ee.Array([1, 1, 1, 9, 9, 9]).argmax()) # [3]\n```"]]