이미지 개요

시작하기 문서에서 언급했듯이 래스터 데이터는 Earth Engine에서 Image 객체로 표시됩니다. 이미지는 하나 이상의 밴드로 구성되며 각 밴드에는 자체 이름, 데이터 유형, 배율, 마스크, 프로젝션이 있습니다. 각 이미지에는 속성 집합으로 저장된 메타데이터가 있습니다.

ee.Image 생성자

Earth Engine 애셋 ID를 ee.Image 생성자에 붙여넣어 이미지를 로드할 수 있습니다. 이미지 ID는 데이터 카탈로그에서 확인할 수 있습니다. 예를 들어 디지털 고도 모델 (NASADEM)에 적용할 수 있습니다.

코드 편집기 (JavaScript)

var loadedImage = ee.Image('NASA/NASADEM_HGT/001');

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

loaded_image = ee.Image('NASA/NASADEM_HGT/001')

코드 편집기 검색 도구를 통해 이미지를 찾는 것도 동일합니다. 애셋을 가져오면 이미지 구성 코드가 Code Editor의 가져오기 섹션에 자동으로 작성됩니다. 개인 애셋 IDee.Image 생성자의 인수로 사용할 수도 있습니다.

ee.ImageCollection에서 ee.Image 가져오기

컬렉션에서 이미지를 가져오는 일반적인 방법은 필터를 사용하여 컬렉션을 필터링하는 것입니다. 이때 필터는 특이성이 감소하는 순서로 적용합니다. 예를 들어 Sentinel-2 표면 반사율 컬렉션에서 이미지를 가져오려면 다음 단계를 따르세요.

코드 편집기 (JavaScript)

var first = ee.ImageCollection('COPERNICUS/S2_SR')
                .filterBounds(ee.Geometry.Point(-70.48, 43.3631))
                .filterDate('2019-01-01', '2019-12-31')
                .sort('CLOUDY_PIXEL_PERCENTAGE')
                .first();
Map.centerObject(first, 11);
Map.addLayer(first, {bands: ['B4', 'B3', 'B2'], min: 0, max: 2000}, 'first');

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

first = (
    ee.ImageCollection('COPERNICUS/S2_SR')
    .filterBounds(ee.Geometry.Point(-70.48, 43.3631))
    .filterDate('2019-01-01', '2019-12-31')
    .sort('CLOUDY_PIXEL_PERCENTAGE')
    .first()
)

# Define a map centered on southern Maine.
m = geemap.Map(center=[43.7516, -70.8155], zoom=11)

# Add the image layer to the map and display it.
m.add_layer(
    first, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 2000}, 'first'
)
display(m)

정렬은 필터 뒤에 적용됩니다. 전체 컬렉션을 정렬하지 마세요.

Cloud GeoTIFF의 이미지

ee.Image.loadGeoTIFF()를 사용하여 Google Cloud StorageCloud Optimized GeoTIFF에서 이미지를 로드할 수 있습니다. 예를 들어 Google Cloud에 호스팅된 공개 Landsat 데이터 세트에는 Landsat 8 장면의 밴드 5에 해당하는 이 GeoTIFF가 포함되어 있습니다. ee.Image.loadGeoTIFF()를 사용하여 Cloud Storage에서 이 이미지를 로드할 수 있습니다.

코드 편집기 (JavaScript)

var uri = 'gs://gcp-public-data-landsat/LC08/01/001/002/' +
    'LC08_L1GT_001002_20160817_20170322_01_T2/' +
    'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF';
var cloudImage = ee.Image.loadGeoTIFF(uri);
print(cloudImage);

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

uri = (
    'gs://gcp-public-data-landsat/LC08/01/001/002/'
    + 'LC08_L1GT_001002_20160817_20170322_01_T2/'
    + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF'
)
cloud_image = ee.Image.loadGeoTIFF(uri)
display(cloud_image)

Earth Engine에서 Cloud Storage로 내보낸 Cloud 최적화 GeoTIFF를 새로고침하려면 내보낼 때 여기에 설명된 대로 cloudOptimizedtrue로 설정하세요.

Zarr v2 배열의 이미지

ee.Image.loadZarrV2Array()를 사용하여 Google Cloud StorageZarr v2 배열에서 이미지를 로드할 수 있습니다. 예를 들어 Google Cloud에서 호스팅되는 공개 ERA5 데이터 세트에는 지구 표면에서 증발한 물의 미터에 해당하는 이 Zarr v2 배열이 포함되어 있습니다. ee.Image.loadZarrV2Array()를 사용하여 Cloud Storage에서 이 배열을 로드할 수 있습니다.

코드 편집기 (JavaScript)

var timeStart = 1000000;
var timeEnd = 1000010;
var zarrV2ArrayImage = ee.Image.loadZarrV2Array({
  uri:
      'gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',
  proj: 'EPSG:4326',
  starts: [timeStart],
  ends: [timeEnd]
});
print(zarrV2ArrayImage);
Map.addLayer(zarrV2ArrayImage, {min: -0.0001, max: 0.00005}, 'Evaporation');

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

time_start = 1000000
time_end = 1000010
zarr_v2_array_image = ee.Image.loadZarrV2Array(
    uri='gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',
    proj='EPSG:4326',
    starts=[time_start],
    ends=[time_end],
)

display(zarr_v2_array_image)

m.add_layer(
    zarr_v2_array_image, {'min': -0.0001, 'max': 0.00005}, 'Evaporation'
)
m

상수 이미지

ID로 이미지를 로드하는 것 외에도 상수, 목록 또는 기타 적절한 Earth Engine 객체에서 이미지를 만들 수도 있습니다. 다음은 이미지를 만들고, 밴드 하위 집합을 가져오고, 밴드를 조작하는 메서드를 보여줍니다.

코드 편집기 (JavaScript)

// Create a constant image.
var image1 = ee.Image(1);
print(image1);

// Concatenate two images into one multi-band image.
var image2 = ee.Image(2);
var image3 = ee.Image.cat([image1, image2]);
print(image3);

// Create a multi-band image from a list of constants.
var multiband = ee.Image([1, 2, 3]);
print(multiband);

// Select and (optionally) rename bands.
var renamed = multiband.select(
    ['constant', 'constant_1', 'constant_2'], // old names
    ['band1', 'band2', 'band3']               // new names
);
print(renamed);

// Add bands to an image.
var image4 = image3.addBands(ee.Image(42));
print(image4);

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

# Create a constant image.
image_1 = ee.Image(1)
display(image_1)

# Concatenate two images into one multi-band image.
image_2 = ee.Image(2)
image_3 = ee.Image.cat([image_1, image_2])
display(image_3)

# Create a multi-band image from a list of constants.
multiband = ee.Image([1, 2, 3])
display(multiband)

# Select and (optionally) rename bands.
renamed = multiband.select(
    ['constant', 'constant_1', 'constant_2'],  # old names
    ['band1', 'band2', 'band3'],  # new names
)
display(renamed)

# Add bands to an image.
image_4 = image_3.addBands(ee.Image(42))
display(image_4)