gee-community/geemap

geemap.download_ee_image

qianmoeast opened this issue · 3 comments


HttpError Traceback (most recent call last)
File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\ee\data.py:354, in _execute_cloud_call(call, num_retries)
353 try:
--> 354 return call.execute(num_retries=num_retries)
355 except googleapiclient.errors.HttpError as e:

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\googleapiclient_helpers.py:130, in positional..positional_decorator..positional_wrapper(*args, **kwargs)
129 logger.warning(message)
--> 130 return wrapped(*args, **kwargs)

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\googleapiclient\http.py:938, in HttpRequest.execute(self, http, num_retries)
937 if resp.status >= 300:
--> 938 raise HttpError(resp, content, uri=self.uri)
939 return self.postproc(resp, content)

HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Computation timed out.". Details: "Computation timed out.">

During handling of the above exception, another exception occurred:

EEException Traceback (most recent call last)
Cell In[4], line 1
----> 1 geemap.download_ee_image(
2 image=FVC,
3 filename=pathFVC,
4 region=table.geometry(),
5 crs_transform=crs_transform,
6 crs=crs,
7 scale=10,
8 )
10 geemap.download_ee_image(
11 image=FR,
12 filename=pathFR,
(...)
16 scale=10,
17 )
20 geemap.download_ee_image(
21 image=slope,
22 filename=pathslope,
(...)
26 scale=10,
27 )

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geemap\common.py:12440, in download_ee_image(image, filename, region, crs, crs_transform, scale, resampling, dtype, overwrite, num_threads, max_tile_size, max_tile_dim, shape, scale_offset, unmask_value, **kwargs)
12437 kwargs["scale_offset"] = scale_offset
12439 img = gd.download.BaseImage(image)

12440 img.download(filename, overwrite=overwrite, num_threads=num_threads, **kwargs)

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geedim\download.py:841, in BaseImage.download(self, filename, overwrite, num_threads, max_tile_size, max_tile_dim, **kwargs)
838 raise FileExistsError(f'{filename} exists')
840 # prepare (resample, convert, reproject) the image for download
--> 841 exp_image, profile = self._prepare_for_download(**kwargs)
843 # get the dimensions of an image tile that will satisfy GEE download limits
844 tile_shape, num_tiles = self._get_tile_shape(exp_image, max_tile_size=max_tile_size, max_tile_dim=max_tile_dim)

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geedim\download.py:526, in BaseImage._prepare_for_download(self, set_nodata, **kwargs)
519 """
520 Prepare the encapsulated image for tiled GeoTIFF download. Will reproject, resample, clip and convert the image
521 according to the provided parameters.
522
523 Returns the prepared image and a rasterio profile for the downloaded GeoTIFF.
524 """
525 # resample, convert, clip and reproject image according to download params
--> 526 exp_image = self._prepare_for_export(**kwargs)
527 # see float nodata workaround note in Tile.download(...)
528 nodata_dict = dict(
529 float32=self._float_nodata,
530 float64=self._float_nodata,
(...)
536 int32=np.iinfo('int32').min,
537 ) # yapf: disable

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geedim\download.py:440, in BaseImage._prepare_for_export(self, crs, crs_transform, shape, region, scale, resampling, dtype, scale_offset)
432 if not self.has_fixed_projection:
433 # if the image has no fixed projection, either crs, region, & scale; or crs, crs_transform and shape
434 # must be specified
435 raise ValueError(
436 f'This image does not have a fixed projection, you need to specify a crs, region & scale; or a '
437 f'crs, crs_transform & shape.'
438 )
--> 440 if (not self.bounded) and (not region and (not crs or not crs_transform or not shape)):
441 # if the image has no footprint (i.e. it is 'unbounded'), either region; or crs, crs_transform and shape
442 # must be specified
443 raise ValueError(
444 f'This image is unbounded, you need to specify a region; or a crs, crs_transform and '
445 f'shape.'
446 )
448 if self.crs == 'EPSG:4326' and not scale and not shape:
449 # If the image is in EPSG:4326, either scale (in meters); or shape must be specified.
450 # Note that ee.Image.prepare_for_export() expects a scale in meters, but if the image is EPSG:4326,
451 # the default scale is in degrees.

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geedim\download.py:237, in BaseImage.bounded(self)
235 # TODO: an unbounded region could also have these bounds
236 unbounded_bounds = (-180, -90, 180, 90)
--> 237 return (self.footprint is not None) and (features.bounds(self.footprint) != unbounded_bounds)

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geedim\download.py:168, in BaseImage.footprint(self)
165 @Property
166 def footprint(self) -> Optional[Dict]:
167 """ Geojson polygon of the image extent. None if the image is a composite. """
--> 168 if ('properties' not in self._ee_info) or ('system:footprint' not in self._ee_info['properties']):
169 return None
170 return self._ee_info['properties']['system:footprint']

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\geedim\download.py:105, in BaseImage._ee_info(self)
103 """ Earth Engine image metadata. """
104 if self.__ee_info is None:
--> 105 self.__ee_info = self._ee_image.getInfo()
106 return self.__ee_info

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\ee\image.py:116, in Image.getInfo(self)
108 def getInfo(self) -> Optional[Any]:
109 """Fetch and return information about this image.
110
111 Returns:
(...)
114 properties - Dictionary containing the image's metadata properties.
115 """
--> 116 return super().getInfo()

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\ee\computedobject.py:105, in ComputedObject.getInfo(self)
99 def getInfo(self) -> Optional[Any]:
100 """Fetch and return information about this object.
101
102 Returns:
103 The object can evaluate to anything.
104 """
--> 105 return data.computeValue(self)

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\ee\data.py:1021, in computeValue(obj)
1018 body = {'expression': serializer.encode(obj, for_cloud_api=True)}
1019 _maybe_populate_workload_tag(body)
-> 1021 return _execute_cloud_call(
1022 _get_cloud_projects()
1023 .value()
1024 .compute(body=body, project=_get_projects_path(), prettyPrint=False)
1025 )['result']

File d:\ProgramData\Miniconda3\envs\geeclone\lib\site-packages\ee\data.py:356, in _execute_cloud_call(call, num_retries)
354 return call.execute(num_retries=num_retries)
355 except googleapiclient.errors.HttpError as e:
--> 356 raise _translate_cloud_exception(e)

EEException: Computation timed out.

I first downloaded an image using geemap.download_ee_image, and no error was reported. But after I refreshed and used geemap.download_ee_image to download the image, an EEException: Computation timed out occurred.

Very troublesome, Teacher Wu

Not a geemap problem. Try a small image or coarser resolution image

Okay, thank you very much