在通过Google Colab使用Python导出图像的时候,运行的时候发现导错了某些波段信息,然而历史巨轮已经滚动了,想取消任务,一时间发现找不到叉叉,只能等导出完再删掉。之后,找了一些方法,这里做个记录。
GEE实战 | 取消单个任务或者批处理cancel a task / tasks
开始任务
先介绍下通过Python导出,好处是不用点击run就可以开始任务~
单个任务
Create an export task:
task = ee.batch.Export.image.toDrive(image=my_image, # an ee.Image object.
region=my_geometry, # an ee.Geometry object.
description='mock_export',
folder='gdrive_folder',
fileNamePrefix='mock_export',
scale=1000,
crs='EPSG:4326')
Start an export task:
task.start()
Check export task status:
task.status()
多个任务
多个导出通过for循环就好了。
# Export all the training data (in many pieces), with one task per geometry.
for g in range(trainingPolys.size().getInfo()):
geomSample = ee.FeatureCollection([])
for i in range(n):
sample = arrays.sample(
region = ee.Feature(trainingPolysList.get(g)).geometry()