[英]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. 我需要在两个MODIS集合中应用过滤器功能,以便按日期查找常见的图像,但是我不知道如何在Python API中进行操作。 I have this error: EEException: Can not encode object: set (['system: time_start'])
我遇到此错误:EEException:无法编码对象:设置([['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: 假设您的concatbands函数是此定义:
def concatBands(image):
return ee.Image.cat(image.get('primary'),image.get('secondary'))
in python the filtertimeEq should be written: 在python中,filtertimeEq应该写为:
filterTimeEq = ee.Filter.equals(leftField = 'system:time_start',rightField = 'system:time_start')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.