Pengumuman: Semua project nonkomersial yang terdaftar untuk menggunakan Earth Engine sebelum
15 April 2025 harus
memverifikasi kelayakan nonkomersial untuk mempertahankan akses Earth Engine.
ee.Array.argmax
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menampilkan posisi, sebagai daftar indeks di setiap sumbu larik, dari nilai maksimum dalam larik, atau null jika larik kosong. Jika ada beberapa kemunculan nilai maksimum, akan menampilkan posisi yang pertama.
Penggunaan | Hasil |
---|
Array.argmax() | Daftar |
Argumen | Jenis | Detail |
---|
ini: array | Array | |
Contoh
Code Editor (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]
Penyiapan Python
Lihat halaman
Lingkungan Python untuk mengetahui informasi tentang Python API dan penggunaan
geemap
untuk pengembangan interaktif.
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]
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[null,null,["Terakhir diperbarui pada 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```"]]