ee.Array.identity

สร้างเมทริกซ์เอกลักษณ์ 2 มิติที่มีขนาดที่กำหนด

การใช้งานการคืนสินค้า
ee.Array.identity(size)อาร์เรย์
อาร์กิวเมนต์ประเภทรายละเอียด
sizeจำนวนเต็มความยาวของแต่ละแกน

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (JavaScript)

// []
print(ee.Array.identity(0));

// [[1]]
print(ee.Array.identity(1));

// [[1,0],
//  [0,1]]
print(ee.Array.identity(2));

// [[1,0,0],
//  [0,1,0],
//  [0,0,1]]
print(ee.Array.identity(3));

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

# []
display(ee.Array.identity(0))

# [[1]]
display(ee.Array.identity(1))

# [[1, 0],
#  [0, 1]]
display(ee.Array.identity(2))

# [[1, 0, 0],
#  [0, 1, 0],
#  [0, 0, 1]]
display(ee.Array.identity(3))