REMOTE SENSING

geemap: Terra Vegetation Continuous Fields Yearly Global 250m 검색 및 다운로드

유병혁 2023. 8. 3. 10:46

안녕하세요? 이번 글은 geemap를 통해 Earth Engine Data Catalog에서 제공하는 Terra Vegetation Continuous Fields Yearly Global 250m 이미지 컬렉션을 조회하고 다운로드 받는 과정을 정리해 보겠습니다.

Earth Engine Data Catalog

Earth Engine Data Catalog는 Google Earth Engine에서 사용 가능한 데이터셋 및 이미지 컬렉션에 대한 정보를 포함하는 온라인 데이터 리포지토리입니다. 데이터셋(Dataset)은 Google Earth Engine에서 관리되는 정형 데이터를, 이미지 컬렉션(Image Collection)은 동일한 데이터셋의 여러 시간 스탬프들을 묶어서 처리하기 쉽게 만든 개념입니다.

 

Terra Vegetation Continuous Fields Yearly Global 250m

 

MOD44B.006 Terra Vegetation Continuous Fields Yearly Global 250m  |  Earth Engine Data Catalog  |  Google for Developers

The Terra MODIS Vegetation Continuous Fields (VCF) product is a sub-pixel-level representation of surface vegetation cover estimates globally. Designed to continuously represent Earth's terrestrial surface as a proportion of basic vegetation traits, it pro

developers.google.com

MOD44B.006 Terra MODIS Vegetation Continuous Fields(VCF)지표면 식생 피복을 세 가지 지면 피복 구성요소의 변화로 나타내는 전세계 데이터입니다. 

  • 수목 피복 확률(percent tree cover)
  • 비수목 피복 확률(percent non-tree cover)
  • 비식생(나지) 확률 (percent non-vegetated, bare)

MODIS 기기는 Terra와 Aqua 위성 모두에서 작동하고 있습니다. 이 기기는 2,330 km의 관측 폭을 갖고 있으며 지구 전체 표면을 1일에서 2일에 한 번씩 관측합니다. 기기의 감지기는 0.405에서 14.385 µm까지 36개의 스펙트럼 밴드를 측정하며, 데이터를 250m, 500m, 1,000m의 세 가지 공간 해상도에서 획득합니다. VCF 데이터셋의 각 변수들은 250m급 공간해상도로 제공됩니다.


Terra Vegetation Continuous Fields Yearly Global 250m
 데이터 검색 및 다운로드

geemap과 ee 모듈을 가져오고, Earth Engine에 인증하고 초기화하는 작업을 수행합니다. ee.Authenticate() 함수는 Earth Engine과 연결된 Google 계정으로 인증하고 인증 토큰을 얻는 역할을 합니다. 한 번 인증이 완료되면, 그 이후에는 인증 코드를 다시 입력할 필요 없이 해당 인증 토큰을 사용하여 Earth Engine과 통신할 수 있습니다.

import geemap
import ee

# Earth Engine 인증
ee.Authenticate()

# Earth Engine 초기화
ee.Initialize()

Earth Engine Data Catalog에서 FAO GAUL (Global Administrative Unit Layers) 2015 국가 경계를 불러와, 대한민국을 필터링하고 해당 경계를 시각화합니다. FeatureCollection은 점, 선, 폴리곤과 같은 공간 데이터를 나타내는데 사용됩니다.

 

FAO GAUL: Global Administrative Unit Layers 2015, Country Boundaries  |  Earth Engine Data Catalog  |  Google for Developers

The Global Administrative Unit Layers (GAUL) compiles and disseminates the best available information on administrative units for all the countries in the world, providing a contribution to the standardization of the spatial dataset representing administra

developers.google.com

# FAO GAUL: Global Administrative Unit Layers 2015, Country Boundaries
countries = ee.FeatureCollection("FAO/GAUL/2015/level0")

# 'ADM0_NAME' 필드를 기준으로 '대한민국' 필터링
kr = countries.filter(ee.Filter.eq('ADM0_NAME', 'Republic of Korea'))

# 지도 생성
Map = geemap.Map()

# 지도에 경계 표시
Map.centerObject(kr, 7) # 경계 중심으로 지도 확대
Map.addLayer(kr, {}, "Republic of Korea")

# 지도 출력
Map

Percent_Tree_Cover를 시각화해 봅니다.

MODIS 이미지 컬렉션에서 '2003-01-01'부터 '2020-12-31' 기간 데이터를 선택하고, 녹지 지수들의 중앙값을 구해 봅니다.

# Terra Vegetation Continuous Fields Yearly Global 250m
MODIS = ee.ImageCollection('MODIS/006/MOD44B')

# 날짜 필터링 및 녹지 지수 선택
filtered_MODIS = MODIS.filterDate('2003-01-01', '2020-12-31')
selected_MODIS = filtered_MODIS.select('Percent_Tree_Cover')

# 녹지 지수의 중앙값 계산
MedianPTC = selected_MODIS.median()
visParams = {
    'min': 0,
    'max': 100,
    'palette': ['bbe029', '0a9501', '074b03']}

# 지도 생성
Map = geemap.Map()

Map.centerObject(kr, 7) # 경계 중심으로 지도 확대
Map.addLayer(MedianPTC, visParams, 'Percent Tree Cover')
Map

녹지지수 중앙값을 대한민국 영역으로 잘라내어 GeoTIFF 파일로 저장합니다.

# 대한민국 영역으로 잘라내기
MedianPTC_kr = MedianPTC.clipToCollection(kr)

# 데이터를 GeoTIFF 형식으로 저장
output_file = 'D:/GEODATA/pct_tree_cover.tif'
geemap.ee_export_image(MedianPTC_kr, filename=output_file, region=kr.geometry(), scale=250)

요청한 데이터의 크기가 서버에서 허용하는 최대 요청 크기를 초과했기 때문에 오류가 발생합니다. Google Earth Engine에서 처리한 결과물이나 대용량의 데이터를 내려받을 때, 다운로드 용량이 크거나 다른 사용자와 공유해야 할 때는 Google Drive를 활용하는 것이 유용합니다. Google Drive를 사용하면 데이터를 클라우드 상에 저장하고, 필요할 때 다운로드하거나 공유할 수 있습니다.

Generating URL ...
An error occurred while downloading.
Total request size (62127918 bytes) must be less than or equal to 50331648 bytes.

geemap 라이브러리를 이용하여 Google Earth Engine에서 생성된 이미지를 Google Drive로 내보내는 작업을 수행합니다. 여기서는 "MedianPTC_kr" 변수에 저장된 녹지 지수 데이터를 Google Drive의 "export" 폴더에 250m 해상도로 저장하는 작업을 수행합니다.

# 데이터를 Google Drive에 저장
geemap.ee_export_image_to_drive(
    MedianPTC_kr,
    description='pct_tree_cover',
    folder='export',
    region=kr.geometry(),
    scale=250
)

이렇게 함으로써 Google Earth Engine에서 생성한 이미지 데이터를 Google Drive에 보관하거나 공유할 수 있습니다. 데이터 생성까지 약간의 시간이 소요됩니다.

이제 해당 데이터는 QGIS에서도 다룰 수 있습니다. 여기까지 geemap를 통해 Earth Engine Data Catalog에서 제공하는 Terra Vegetation Continuous Fields Yearly Global 250m 데이터를 조회하고 다운로드 받는 과정을 정리해 봤습니다.

pct_tree_cover.tif
3.41MB
1910_geemap_Terra Vegetation Continuous Fields Yearly Global 250m 검색 및 다운로드.ipynb
0.00MB