在 GEE Python API 中的 inner.Join 函数中使用过滤函数
Using a filter function in a inner.Join function in GEE Python API
我需要在两个 MODIS 集合中应用过滤功能以按日期查找常见图像,但我不知道如何在 Python API 中执行此操作。我有这个错误:
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)
假设您的 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')
我需要在两个 MODIS 集合中应用过滤功能以按日期查找常见图像,但我不知道如何在 Python API 中执行此操作。我有这个错误:
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)
假设您的 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')