在应用程序中使用筛选函数内部。加入GEE Python API中的函数

2024-04-24 14:52:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要在两个MODIS集合中应用一个filter函数来按日期查找常见图像,但我不知道如何在pythonapi中这样做。我有一个错误: EEException:无法编码object:set(['system:time\u start'])

GEE function:
    var filterTimeEq = ee.Filter.equals({
    leftField: 'system:time_start',
    rightField: 'system:time_start'
    });

GEE function in Python API:
    leftField = 'system:time_start'
    rightField = 'system:time_start'
    filterTimeEq = ee.Filter.equals({leftField, rightField})

Python API Code:
    terra = ee.ImageCollection('MODIS/006/MOD10A1').filterBounds(pt).select('NDSI_Snow_Cover').sort('system:time_start').filterDate('2016-01-01', '2017-12-31')
    aqua = ee.ImageCollection('MODIS/006/MYD10A1').filterBounds(pt).select('NDSI_Snow_Cover').sort('system:time_start').filterDate('2016-01-01', '2017-12-31')
    innerJoin = ee.Join.inner()
    innerJoinedCollection = innerJoin.apply(terra, aqua, filterTimeEq)
    joinedCollection = innerJoinedCollection.map(concatBands)
    yearlyCollection = joinedCollection.map(maxVal)
    start = ee.Date(yearlyCollection.first().get('system:time_start'))
    maxCollection=ee.ImageCollection(yearlyCollection)
    SnowCount = maxCollection.map(snowMask)

Tags: maptimefunctionfiltermodissystemstartee
1条回答
网友
1楼 · 发布于 2024-04-24 14:52:06

假设concatbands函数是以下定义:

def concatBands(image): 
    return ee.Image.cat(image.get('primary'),image.get('secondary'))

在python中,filtertimeEq应该写为:

filterTimeEq = ee.Filter.equals(leftField = 'system:time_start',rightField = 'system:time_start')

相关问题 更多 >