ee.Array.argmax

موضع الحد الأقصى للقيمة في صفيف، وذلك كقائمة فهارس في كل محور من محاور الصفيف، أو تعرض القيمة null إذا كان الصفيف فارغًا. في حال تكرار الحد الأقصى عدة مرات، تعرض هذه الدالة موضع المرة الأولى.

الاستخدامالمرتجعات
Array.argmax()قائمة
الوسيطةالنوعالتفاصيل
هذا: arrayمصفوفة

أمثلة

محرّر الرموز البرمجية (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]

إعداد Python

راجِع صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام geemap للتطوير التفاعلي.

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]