AGU2017 icon indicating copy to clipboard operation
AGU2017 copied to clipboard

HttpErrors in 'satellite_analysis' script

Open stephanbuettig opened this issue 5 years ago • 0 comments

Hi,

thanks for sharing the AGU2017 scripts.

Unfortunately I get several HttpErrors:

thumbnail_url = sample_image.getThumbUrl({
    'bands': 'red,green,blue',
    'min': 0,
    'max': 3000,
    'region': sample_image.geometry().bounds().getInfo()
})
IPython.display.HTML('Thumbnail URL: <a href={0}>{0}</a>'.format(thumbnail_url))

gives

---------------------------------------------------------------------------
HttpError                                 Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
    337   try:
--> 338     return call.execute(num_retries=num_retries)
    339   except apiclient.errors.HttpError as e:

/opt/conda/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 

/opt/conda/lib/python3.7/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
    897         if resp.status >= 300:
--> 898             raise HttpError(resp, content, uri=self.uri)
    899         return self.postproc(resp, content)

HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails?fields=name&alt=json returned "Total request size (178037061 bytes) must be less than or equal to 33554432 bytes.">

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
<ipython-input-11-ea97ba0338aa> in <module>
      3     'min': 0,
      4     'max': 3000,
----> 5     'region': sample_image.geometry().bounds().getInfo()
      6 })
      7 IPython.display.HTML('Thumbnail URL: <a href={0}>{0}</a>'.format(thumbnail_url))

/opt/conda/lib/python3.7/site-packages/ee/deprecation.py in Wrapper(*args, **kwargs)
     30           filename=func.__code__.co_filename,
     31           lineno=func.__code__.co_firstlineno + 1)
---> 32       return func(*args, **kwargs)
     33     deprecation_message = '\nDEPRECATED: ' + message
     34     try:

/opt/conda/lib/python3.7/site-packages/ee/image.py in getThumbURL(self, params)
    490     # behaviour.
    491     if data._use_cloud_api:  # pylint: disable=protected-access
--> 492       return data.makeThumbUrl(self.getThumbId(params))
    493     image, params = self._apply_visualization(params)
    494     params['image'] = image

/opt/conda/lib/python3.7/site-packages/ee/image.py in getThumbId(self, params)
    462     image, params = image._apply_visualization(params)  # pylint: disable=protected-access
    463     params['image'] = image
--> 464     return data.getThumbId(params)
    465 
    466   def getThumbURL(self, params=None):

/opt/conda/lib/python3.7/site-packages/ee/data.py in getThumbId(params, thumbType)
    831               parent=_get_projects_path(),
    832               fields='name',
--> 833               body=request))
    834     return {'thumbid': result['name'], 'token': ''}
    835   request = params.copy()

/opt/conda/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
    338     return call.execute(num_retries=num_retries)
    339   except apiclient.errors.HttpError as e:
--> 340     raise _translate_cloud_exception(e)
    341 
    342 

EEException: Total request size (178037061 bytes) must be less than or equal to 33554432 bytes.

I would be very grateful for help!

Greetings

stephanbuettig avatar Mar 13 '20 07:03 stephanbuettig