'Export a geoTIFF file from jupyter notebook to google drive but nothing appears in my google drive

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 :)



Solution 1:[1]

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!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elmstead