Python – Troubleshooting Raster Export Issues from Landsat in Google Colab

google-colabgoogle-earth-enginepythonraster

I am trying to export a multiband image I created from images that I calculated from Landsat images from Google Colab to my Google Drive. I accessed the data and ran calculations on the images via google earth engine in the python environment in colab (e.g., 'import ee'). I have tried everything I can find on the internet to figure out why this image will not export to drive including this post.

#Export image_ALL 
task = ee.batch.Export.image.toDrive(**{
    'image': image_ALL,
    'description': 'imageToDriveExample',
    'folder':'Example_folder',
    'region': PAshp.geometry().bounds().getInfo()['coordinates'],
    'scale': 30
})
task.start()

When I run

task.status()

This is the result

{'creation_timestamp_ms': 1641403075186,
 'description': 'imageToDriveExample',
 'id': 'SOTU4SBOQRHIIWETRJMK4A4H',
 'name': 'projects/earthengine-legacy/operations/SOTU4SBOQRHIIWETRJMK4A4H',
 'start_timestamp_ms': 0,
 'state': 'READY',
 'task_type': 'EXPORT_IMAGE',
 'update_timestamp_ms': 1641403075186} 

Best Answer

Your export snippet looks correct. It takes some time for the status of the task to update. You'll need to run the status check several times to ensure that the state becomes 'COMPLETED'. Additionally, you can check code.earthengine.google.com/tasks to see the list of active tasks you have to see if your task is actually running on the server.

One issue that might be happening is that it is exporting to a location different than where you expect in your Drive. This has happened to me on occasion when I try to export to a subfolder. For example, exporting to /main/subfolder will actually create a new folder in /main called "/main/subfolder" so your script has actually exported to /main/"main/subfolder".

Related Question