1 回答
TA贡献1982条经验 获得超2个赞
与您用 NA 填充间隙的想法类似,我向每个集合添加了一个空带,以匹配其他集合中的相应带。然后我合并了这些集合并制作了一个图表。
s2sr = s2sr.filterBounds(roi).filter(ee.Filter.calendarRange(2020, 2020, 'year'))
l8sr = l8sr.filterBounds(roi).filter(ee.Filter.calendarRange(2020, 2020, 'year'))
// compute some bands to add to each collection
var addS2Bands = function(image){
var s2nd = image.normalizedDifference(['B4','B3']).rename('s2_nd')
var l8nd = ee.Image().rename('l8_nd') // must add an empty band for select() to work on all images
return image.addBands(s2nd).addBands(l8nd)
}
var addL8Bands = function(image){
var l8nd = image.normalizedDifference(['B4','B3']).rename('l8_nd')
var s2nd = ee.Image().rename('s2_nd')
return image.addBands(l8nd).addBands(s2nd)
}
l8sr = l8sr.map(addL8Bands)
s2sr = s2sr.map(addS2Bands)
// merge the collections
var merged = l8sr.merge(s2sr).select(['l8_nd', 's2_nd'])
// plot the collection
var chart = ui.Chart.image.series({
imageCollection: merged,
region: roi,
reducer: ee.Reducer.mean(),
scale: 30
})
print(chart)
https://code.earthengine.google.com/?scriptPath=users%2Fcaseyengstrom%2Freprex%3AuiChartMultiCollection
添加回答
举报