I am using Google Earth Engine Python API to claculate NDVI and Export the result in Google Drive / Google Cloud storage (bucket). I am using the following code to export data to Cloud

task = Export.map.toCloudStorage(
    image = toexport,
    #image = SAVI.visualize({min:0, max:255}),
    description = 'Automation',
    scale = 20,
    bucket = 'gisagnext',
    #fileNamePrefix = 'Automation',
    #path = 'savi/',
    path = 'clip/',
    #path = 'ndvi',
    fileFormat = 'png',
    writePublicTiles = 'true',
    maxZoom = 14,
    minZoom = 4,
    #scale = 20,
    #region = row
    region = geometry1

Now I want to track back the exact time duration of sending data to Google Cloud in Python API.


You can monitor any batch task by periodically querying the task status. Below is an example, similar to the code in your question.

Setup some example data:

# Define an example image.
my_image = ee.Image("CGIAR/SRTM90_V4")
toexport = my_image.visualize(**{ 'min': 1000, 'max': 3000 })

# Define an export region.
region = ee.Geometry.Point(-112.1401, 36.0589).buffer(10000).bounds()
geometry1 = region.getInfo()['coordinates']

Initiate the task:

task = ee.batch.Export.map.toCloudStorage(
  description = 'Automation',
  scale = 20,
  bucket = 'my-bucket-name',
  path = 'test_export_map/',
  fileFormat = 'png',
  writePublicTiles = 'true',

Periodically poll the task status, until it is no longer running:

# Monitor the task.
while task.status()['state'] in ['READY', 'RUNNING']:

For more information, see the Task object's status method.

  • Thanks, but is it possible without tracking? – Avik Betal Jan 25 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.