0

After having searched for a long time for a solution to my problem without succeeding, I'd like to ask you my question here.

I have a python code that creates a geoTIFF file from google earth engine data. I'm running it on jupyter notebook and I want to export the geoTIFF to my google drive.

The code works without error and a shapefile (shp) is embedded as input.

The problem is that nothing appears on my drive, the folder "GEE" that it creates is well created, but it is empty.

Here is the export part of the code:

task = ee.batch.Export.image.toDrive(image=bare1.clip(aoi),
                scale=10,
                region=aoi.getInfo()['coordinates'],
                fileFormat='GeoTIFF',
                description='Active',
                folder='GEE',
                maxPixels=1e9)
task.start()

You should also know that I am a beginner in python :)

Do you have an idea for a solution? Do not hesitate to ask me for more details. Thanks :)

2 Answers2

0

First: Have you checked the code editor (https://code.earthengine.google.com/) to see if there has been an error message that accounts for the lack of export, or if the file is actually being deposited in a different place? One note about the 'folder' parameter, is that (in my understanding) it doesn't create a folder necessily, but instead is just telling GEE to deposit your image in the most recently created folder of the same name, which could be anywhere in your Drive.

Next, have you definitely mounted your Google Drive? I assume so, if the GEE folder is working, but just to be sure you can always run:

from google.colab import drive
drive.mount('/content/drive')

Next, I have found that when I am exporting an image, I need to convert it to double for correct export. So in your case, this would be changing the first line to (adding the .toDouble())

task = ee.batch.Export.image.toDrive(image=bare1.clip(aoi).toDouble())

If that doesn't work: Have you tried exporting other images with this same code? (Ie replacing bare1 with another image that you know works, like ee.Image(1) which makes a blank image where every pixel is the value 1?

Happy to take another look if none of this helps!

Elmstead
  • 64
  • 9
0

The task console in the GEE code editor should give a description of the export error. Exports are finicky with a number of causes for error. A good first place to check is that you didn't exceed the maximum pixels. You can deal with max pixel errors by reducing the number of bands in your image to only include those that you need, or increasing the maxpixel parameter in your export task. Sometimes the following dictionary style formatting works for me although it's not clear why:

task = ee.batch.Export.image.toDrive(**{
    'image':bare1.clip(aoi),
    'scale':10,
    'region': aoi.getInfo()['coordinates'],
    'fileFormat':'GeoTIFF',
    'description':'Active',
    'folder':'GEE',
    'maxPixels':1e9
})
task.start()