gpt4 book ai didi

python - Google Earth Engine Python API,将 ee.list 转换为 Python 列表

转载 作者:行者123 更新时间:2023-12-01 04:28:35 25 4
gpt4 key购买 nike

我正在使用 Google Earth Engine 的 Python API,它提供结果对象,例如 ee.number、ee.list、ee.image。我不知道我错过了哪些细节,但以下代码:

import ee
ee.Initialize()

collection = ee.ImageCollection('MODIS/MCD43A4_NDVI')
print collection.toList(10)

返回:

ee.List({
"type": "Invocation",
"arguments": {
"count": 10,
"collection": {
"type": "Invocation",
"arguments": {
"id": "MODIS/MCD43A4_NDVI"
},
"functionName": "ImageCollection.load"
}
},
"functionName": "Collection.toList"
})

如何获得实际的 Python 列表?使用

显示的任何方法
print dir(collection.toList(10)) 

仅添加到此 JSON 输出。

最佳答案

以下代码返回包含所需信息的字典列表:

import ee
ee.Initialize()

collection = ee.ImageCollection('MODIS/MCD43A4_NDVI')
list = collection.toList(10)
print list.getInfo()

关于python - Google Earth Engine Python API,将 ee.list 转换为 Python 列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32749123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com