在GEE Python API中的inner.Join函数中使用过滤器函数

时间:2018-08-16 01:44:59

标签: python google-earth-engine gee

我需要在两个MODIS集合中应用过滤器功能,以便按日期查找常见的图像,但是我不知道如何在Python API中执行此操作。我有这个错误: EEException:无法编码对象:set(['system:time_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)

1 个答案:

答案 0 :(得分:0)

假设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')