简体   繁体   中英

Using a filter function in a inner.Join function in GEE Python API

I need to apply a filter function in two MODIS collections to find common images by date but I do not know how to do it in the Python API. I have this error: EEException: Can not encode object: 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)

assuming that your concatbands function is this definition:

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

in python the filtertimeEq should be written:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM