下载方法基于Landsatxplore工具包,链接https://github.com/yannforget/landsatxplore
1 数据支持
2 使用方法
landsatxplore支持命令行运行(https://github.com/yannforget/landsatxplore),也可以在解释器中根据需求使用。这里只分享批量量化搜索和下载方法。
2.1 Image搜索与下载
图像搜索可以根据经纬度和起止日期进行检索,同时支持设置云覆盖率。可以根据自己的需求设置dataset的类型。
from landsatxplore.api import API
# 搜索Landsat 8数据
scenes = api.search(
dataset='landsat_ot_c2_l1',
latitude=latitude,
longitude=longitude,
start_date=date,
end_date=date,
max_cloud_cover=80
)
搜索到结果后会返回检索到的信息,使用EarthExplorer.download函数进行下载:
from landsatxplore.earthexplorer import EarthExplorer
ee = EarthExplorer(username, password)
for scene in scenes:
ee.download(scene['entity_id'], output_dir=output_dir)
2.2 自动批量下载landsat数据
完整代码
import pandas as pd
from landsatxplore.api import API
from landsatxplore.earthexplorer import EarthExplorer
import os
import json
from datetime import datetime
from shapely