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 API 및 geemap를 사용한 대화형 개발에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

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]