python - GEE Python API:将图像导出到 Google Drive 失败
问题描述
在使用 App Engine(在本地主机上)运行的应用程序中使用 GEE Python API,我正在尝试将图像导出到 Google Drive 中的文件。该任务似乎已成功启动并完成,但 Google Drive 中未创建任何文件。
我曾尝试在 GEE 代码编辑器中执行等效的 javascript 代码,这很有效,该文件是在 Google Drive 中创建的。在 python 中,我尝试了各种方法来启动任务,但它总是给我相同的结果:任务完成但没有创建文件。
我的python代码如下:
landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515').select(['B4', 'B3', 'B2'])
geometry = ee.Geometry.Rectangle([116.2621, 39.8412, 116.4849, 40.01236])
task_config = {
'description': 'TEST_todrive_desc',
'scale': 30,
'region': geometry,
'folder':'GEEtest'
}
task = ee.batch.Export.image.toDrive(landsat, 'TEST_todrive', task_config)
ee.batch.data.startProcessing(task.id, task.config)
# Note: I also tried task.start() instead of this last line but the problem is the same, task completed, no file created.
# Printing the task list successively
for i in range(10):
tasks = ee.batch.Task.list()
print(tasks)
time.sleep(5)
在打印的任务列表中,任务的状态从 READY 变为 RUNNING 再到 COMPLETED。但是完成后,我的文件夹“GEEtest”(也没有其他任何地方)的 Google Drive 中没有创建任何文件。
我究竟做错了什么?
解决方案
我认为该文件是生成并存储在用于 Python API 的“服务帐户”的谷歌驱动器上,而不是在您使用网络代码编辑器时通常使用的私人帐户上。
推荐阅读
- vba - 禁用并显示 Outlook 邮件中的所有超链接
- c# - 我在更新循环中编写的代码有问题。寻找有关故障排除的指导
- c - RegEnumKeyExA 接收 ERROR_MORE_DATA 的 C 问题
- flutter - AnimatedContainer 对不同的孩子表现不同
- python - 将函数视图转换为基于类的视图 Django
- paypal - PAYMENT.SALE.COMPLETED 的沙盒 paypal Webhooks 事件始终处于待处理状态
- python - 如何从用户定义的标签中获取href标签
- vue.js - 您的测试套件必须包含至少一个测试(通过时拒绝将期望计为测试)
- android - 如何删除以编程方式组合的图片
- java - 用循环填充 JComboBox