zl程序教程

您现在的位置是:首页 >  后端

当前栏目

地球引擎中级教程——python导出 ImageCollection导出图像集合

Python导出引擎教程集合 图像 地球 中级
2023-09-11 14:15:11 时间

Earth Engine 用户最常问的问题之一是 -如何下载集合中的所有图像?Earth Engine API 允许您导出单个图像,但不能导出图像集合。像这样进行批量导出的推荐方法是使用 Python API 的ee.batch.Export函数并使用 Python for 循环来迭代和导出每个图像。该ee.batch模块还使您能够控制任务- 允许您自动导出。

首先初始化:

import ee
ee.Authenticate()
ee.Initialize()
geometry = ee.Geometry.Point([107.61303468448624, 12.130969369851766])
s2 = ee.ImageCollection("COPERNICUS/S2")
rgbVis = {
  'min': 0.0,
  'max': 3000,
  'bands': ['B4', 'B3', 'B2'],
}

# 写一个去云函数并且选择需要计算的波段
def maskS2clouds(image):
  qa = image.select('QA60')
  cloudBitMask = 1 << 10
  cirrusBitMask = 1 << 11
  mask = qa.bitwiseAnd(cloudBitMask).eq(0).And(
             qa.bitwiseAnd(cirrusBitMask).eq(0))
  return image.updateMask(mask) \
      .select("B.*") \
      .copyProperties(ima