ee.data.computePixels (Python only)

이미지 데이터에 임의의 계산을 실행하여 타일을 계산합니다.

반환: 픽셀을 원시 이미지 데이터로 반환합니다.

사용반환 값
ee.data.computePixels(params)객체|값
인수유형세부정보
params객체다음과 같은 값을 갖는 매개변수를 포함하는 객체입니다.
expression - 계산할 표현식입니다.
fileFormat - 결과 파일 형식입니다. 기본값은 png입니다. 사용 가능한 형식은 ImageFileFormat을 참고하세요. 다운로드한 객체를 Python 데이터 객체로 변환하는 추가 형식이 있습니다. 여기에는 구조화된 NumPy 배열로 변환되는 NUMPY_NDARRAY이 포함됩니다.
grid - 데이터를 가져올 픽셀 그리드를 설명하는 매개변수입니다. 데이터의 기본 픽셀 그리드로 기본 설정됩니다.
bandIds - 있는 경우 픽셀을 가져올 특정 밴드 집합을 지정합니다.
visualizationOptions - 있는 경우 원시 데이터를 반환하는 대신 데이터의 8비트 RGB 시각화를 생성하는 데 적용할 시각화 옵션의 집합입니다.
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...