[英]GEE Python API: Showing image fails
我一直在嘗試通過 GEE 上的 Python API 進行故障排除,但我就是無法弄清楚問題所在。 我在論壇上搜索了類似的問題,但我找到的解決方案對解決問題沒有幫助。
我現在試圖在 Google Colab 上簡單地顯示一個圖像。 我的代碼如下:
**# Get image collection**
sentinel_collection = ee.ImageCollection('COPERNICUS/S2_SR')
**# Filter by bates**
collection_time = sentinel_collection.filterDate('2017-03-28', '2019-12-08')
**# Create a square over region of interest**
square = ee.Geometry.Rectangle(coords=[
[-77.04931434943427,-12.11990118945657],
[-76.98579963996161,-12.09103199034111]],
proj=None)
collection_bounds = collection_time.filterBounds(square)
**# Filter to remove clouds that have > 5% cover**
clouds = collection_bounds.filter(ee.Filter.lt('CLOUD_COVER', 5))
**# Select appropriate bands**
bands = clouds.select(['B4', 'B3', 'B2'])
**# Create a composite image**
composite = bands.median()
**# Show the image**
Image(url=composite.getThumbUrl({'min':0,'max': 3000}))
我相信我的過濾和選擇過程都很好,直到我調用 getThumbnail 方法:
Image(url=composite.getThumbUrl({'min':0,'max': 3000}))
我得到的錯誤代碼是一個一般錯誤 500,這根本沒有幫助:
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-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:
7 frames
HttpError: <HttpError 500 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails?fields=name&alt=json returned "An internal error has occurred">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
/usr/local/lib/python3.6/dist-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: An internal error has occurred
我一直環顧四周,試圖了解問題出在哪里,但老實說我不知道。 在調用 getThumbNail 方法之前,我嘗試了不同的過濾選項,但沒有成功。
歡迎所有幫助!
請參閱此處的文檔。
https://developers.google.com/earth-engine/image_visualization
在頁面底部,它說:
Note: getThumbURL is intended as a method for producing preview images
you might include in presentations, websites, and social media posts.
Its size limitation is 100,000,000 pixels and the browser can timeout
for complicated requests.
If you want a large image or have a complex process, see the Exporting Data page.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.