VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > Python基础教程 >
  • 用python下载gee影像

用python从GEE导出数据到Google drive
替换compute_wet_days函数,实现导出不同的加工数据

# 读取数据
name = "wdc1_era"
africa = ee.Geometry.Polygon(
    [[[-24.64931493978714, 41.307415467346125],
    [-24.64931493978714, -39.031243700520264],
    [56.913185060213095, -39.031243700520264],
    [56.913185060213095, 41.307415467346125]]]
)
years = ["2010", "2012", "2014", "2016", "2018", "2020", "2022"]
 
def compute_wet_days(precip_array):
    threshold = ee.Image.constant(0.001)  # 1mm 降水阈值
    wet_days = precip_array.map(lambda img: img.gte(threshold))
    wet_days_sum = wet_days.reduce(ee.Reducer.sum()).unmask(0, False).rename(name)
    return wet_days_sum.toDouble()
 
for y in years:
    start_date = ee.Date(y + "-1-1")
    end_date = ee.Date(y + "-12-31")
    rainfall_dataset = ee.ImageCollection("ECMWF/ERA5_LAND/DAILY_AGGR") #降雨单位是米
    rainfall = rainfall_dataset.select(['total_precipitation_sum']).filterDate(start_date, end_date).filterBounds(africa)
    wet_days_image = compute_wet_days(rainfall)
    
    # 导出数据
    ee.batch.Export.image.toDrive(
        image=wet_days_image,
        description=f"{name}_{y}",
        folder=f"{name}",
        scale=11000,
        region=africa,
        crs="EPSG:4326",
        maxPixels=1e13
    ).start()

来源:https://www.cnblogs.com/geoli/p/18708056


相关教程