ee.data.computePixels (Python only)

คำนวณไทล์โดยทำการคำนวณที่กำหนดเองในข้อมูลรูปภาพ

การคืนค่า: พิกเซลเป็นข้อมูลรูปภาพดิบ

การใช้งานการคืนสินค้า
ee.data.computePixels(params)ออบเจ็กต์|ค่า
อาร์กิวเมนต์ประเภทรายละเอียด
paramsวัตถุออบเจ็กต์ที่มีพารามิเตอร์ที่มีค่าที่เป็นไปได้ต่อไปนี้
expression - นิพจน์ที่จะคำนวณ
fileFormat - รูปแบบไฟล์ที่ได้ ค่าเริ่มต้นคือ png ดูรูปแบบที่ใช้ได้ใน ImageFileFormat นอกจากนี้ยังมีรูปแบบอื่นๆ ที่แปลง ออบเจ็กต์ที่ดาวน์โหลดเป็นออบเจ็กต์ข้อมูล Python ซึ่งรวมถึง NUMPY_NDARRAY ซึ่งแปลงเป็นอาร์เรย์ NumPy แบบมีโครงสร้าง
grid - พารามิเตอร์ที่อธิบายตารางกริดพิกเซลที่จะดึงข้อมูล ค่าเริ่มต้นจะเป็นตารางกริดพิกเซลดั้งเดิมของข้อมูล
bandIds - หากมี จะระบุชุดแถบที่เฉพาะเจาะจงซึ่งใช้รับพิกเซล
visualizationOptions - หากมี ชุดตัวเลือกการแสดงข้อมูลผ่านภาพที่จะใช้ เพื่อสร้างการแสดงข้อมูลผ่านภาพ RGB 8 บิต แทนที่จะแสดงข้อมูลดิบ
workloadTag - แท็กที่ผู้ใช้ระบุเพื่อติดตามการคำนวณนี้

ตัวอย่าง

การตั้งค่า Python

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

import ee
import geemap.core as geemap

Colab (Python)

# Region of interest.
coords = [
    -121.58626826832939,
    38.059141484827485,
]
region = ee.Geometry.Point(coords)

# Sentinel-2 median composite.
image = (ee.ImageCollection('COPERNICUS/S2')
              .filterBounds(region)
              .filterDate('2020-04-01', '2020-09-01')
              .median())

# Make a projection to discover the scale in degrees.
proj = ee.Projection('EPSG:4326').atScale(10).getInfo()

# Get scales out of the transform.
scale_x = proj['transform'][0]
scale_y = -proj['transform'][4]

# Make a request object.
request = {
    'expression': image,
    'fileFormat': 'PNG',
    'bandIds': ['B4', 'B3', 'B2'],
    'grid': {
        'dimensions': {
            'width': 640,
            'height': 640
        },
        'affineTransform': {
            'scaleX': scale_x,
            'shearX': 0,
            'translateX': coords[0],
            'shearY': 0,
            'scaleY': scale_y,
            'translateY': coords[1]
        },
        'crsCode': proj['crs'],
    },
    'visualizationOptions': {'ranges': [{'min': 0, 'max': 3000}]},
}

image_png = ee.data.computePixels(request)
# Do something with the image...