[英]Using the below function I am getting an error when I convert the GEE javascript to Python script
[英]Using a filter function in a inner.Join function in GEE Python API
我需要在兩個MODIS集合中應用過濾器功能,以便按日期查找常見的圖像,但是我不知道如何在Python API中進行操作。 我遇到此錯誤: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)
假設您的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')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.