1

I need to download a bunch of Landsat images from Google Earth Engine, and I'm doing it in its Python API with

task = ee.batch.Export.image(IMAGE, NAME, config=CONFIG)
task.start()

Though it's working, the speed is extremely slow. The size of my images is around 70kb, but each takes 4 min or longer. Currently this happens in a for loop, so how can I, if possible, pack up multiple images as one task? Or other ways to speed up this process?

NING LI
  • 11
  • 1
  • 2
  • I change from local python scripts to [colab](https://colab.research.google.com). I can't say why but the response on a `.getInfo()` is several times faster ;) – till Kadabra Jan 21 '20 at 09:39
  • If you were running a separate script for every download, then you might have been spending a lot of time authenticating and initializing the library for every image. In colab, that's all paid once "at the top". – Noel Gorelick Jun 07 '21 at 20:56

2 Answers2

4

The startup costs for an export are pretty high. If you're just exporting tiny pieces, you might be able to do it with image.getThumbnail for RGB visualized images, or image.getDownloadURL() for raw numbers.

The getThumbnail() function will give you a PNG or JPEG and getDownloadURL() will give you a zipfile with the bands as individual geotiffs. Note that both are unreliable for large downloads or images that take a lot of computation. Since the image starts being computed once you access the resulting URL, there's no way to communicate failure; if something goes wrong, you just get a empty/corrupt file.

loki
  • 9,816
  • 7
  • 56
  • 82
Noel Gorelick
  • 489
  • 2
  • 10
0

You simply can't. It is a process that takes place in Google's servers, so you can do nothing about it. The only thing I can think of is that: if you make unnecessary operations it may take longer, I guess. For example (a very simple one):

img_1 = ee.Image(A).add(ee.Image(B)).add(ee.Image(C)).subtract(ee.Image(B))

img_2 = ee.Image(A).add(ee.Image(C))

exporting img_1 could take longer than exporting img_2. But I'm only guessing because I don't really know what happens on the "server side".. you could ask the people who do know that in the Earth Engine Forum (https://groups.google.com/forum/#!forum/google-earth-engine-developers).

By the way, if you use the Python API, this could be useful: https://github.com/gee-community/gee_tools

Rodrigo E. Principe
  • 1,281
  • 16
  • 26