ee.Array.pow

ยกกำลังค่าแรกด้วยค่าที่สองทีละรายการ

การใช้งานการคืนสินค้า
Array.pow(right)อาร์เรย์
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ leftอาร์เรย์ค่าด้านซ้าย
rightอาร์เรย์ค่าทางด้านขวา

ตัวอย่าง

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

var empty = ee.Array([], ee.PixelType.int8());
print(empty.pow(empty));  // []

// [0.25,-0.5,1,-2,4,-8]
print(ee.Array([-2, -2, -2, -2, -2, -2]).pow([-2, -1, 0, 1, 2, 3]));

// [1,-1,1,-1,1,-1]
print(ee.Array([-1, -1, -1, -1, -1, -1]).pow([-2, -1, 0, 1, 2, 3]));

// print(ee.Array([0, 0, 0, 0, 0, 0]).pow([-2, -1, 0, 1, 2, 3]));
print(ee.Array([0, 0, 0, 0]).pow([0, 1, 2, 3]));

// [1,1,1,1,1,1]
print(ee.Array([1, 1, 1, 1, 1, 1]).pow([-2, -1, 0, 1, 2, 3]));

// [0.25,0.5,1,2,4,8]
print(ee.Array([2, 2, 2, 2, 2, 2]).pow([-2, -1, 0, 1, 2, 3]));

// [0.009999999776482582,
//  0.10000000149011612,
//  1,
//  10,
//  100,
//  1000]
print(ee.Array([10, 10, 10, 10, 10, 10]).pow([-2, -1, 0, 1, 2, 3]));

// [0.009999999776482582,
//  0.10000000149011612,
//  1,
//  10,
//  100,
//  1000]
print(ee.Array([10, 10, 10, 10, 10, 10], ee.PixelType.int32())
        .pow([-2, -1, 0, 1, 2, 3]));

การตั้งค่า Python

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

import ee
import geemap.core as geemap

Colab (Python)

empty = ee.Array([], ee.PixelType.int8())
display(empty.pow(empty))  # []

# [0.25, -0.5, 1, -2, 4, -8]
display(ee.Array([-2, -2, -2, -2, -2, -2]).pow([-2, -1, 0, 1, 2, 3]))

# [1, -1, 1, -1, 1, -1]
display(ee.Array([-1, -1, -1, -1, -1, -1]).pow([-2, -1, 0, 1, 2, 3]))

# ['Infinity', 'Infinity', 1, 0, 0, 0]
display(ee.Array([0, 0, 0, 0, 0, 0]).pow([-2, -1, 0, 1, 2, 3]))

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

# [1, 1, 1, 1, 1, 1]
display(ee.Array([1, 1, 1, 1, 1, 1]).pow([-2, -1, 0, 1, 2, 3]))

# [0.25, 0.5, 1, 2, 4, 8]
display(ee.Array([2, 2, 2, 2, 2, 2]).pow([-2, -1, 0, 1, 2, 3]))

# [0.009999999776482582,
#  0.10000000149011612,
#  1,
#  10,
#  100,
#  1000]
display(ee.Array([10, 10, 10, 10, 10, 10]).pow([-2, -1, 0, 1, 2, 3]))

# [0.009999999776482582,
#  0.10000000149011612,
#  1,
#  10,
#  100,
#  1000]
display(ee.Array([10, 10, 10, 10, 10, 10], ee.PixelType.int32())
        .pow([-2, -1, 0, 1, 2, 3]))