Charts 生成图表时出错:没有任何要素包含非空值";系统:时间“启动”;。谷歌地球引擎

Charts 生成图表时出错:没有任何要素包含非空值";系统:时间“启动”;。谷歌地球引擎,charts,error-handling,time-series,timeserieschart,google-earth-engine,Charts,Error Handling,Time Series,Timeserieschart,Google Earth Engine,我使用的是谷歌地球引擎,我使用了一个我在网上找到的叫做临时收集的函数来计算一年内的月平均值。然后我在地图上展示了它们,但我也希望能为它们制作一张图表。请参阅下面的代码 var BIOT = ee.Feature( // BIOT ee.Geometry.Rectangle(70.7, -4.7, 72.9, -7.7), {label: 'BIOT'}); var sst = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI').sele

我使用的是谷歌地球引擎,我使用了一个我在网上找到的叫做临时收集的函数来计算一年内的月平均值。然后我在地图上展示了它们,但我也希望能为它们制作一张图表。请参阅下面的代码

var BIOT = ee.Feature(  // BIOT
ee.Geometry.Rectangle(70.7, -4.7, 72.9, -7.7), {label: 'BIOT'});

var sst = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI').select('sst')

var sstMonthly = temporalCollection(sst, ee.Date('2013-01-01'), 12, 1, 
'month');
print('sstMonthly', sstMonthly)

var check = ee.Image(sstMonthly.first());
Map.addLayer(check, {bands: 'sst_mean', min: 0, max: 40, 
'palette':"0000ff,32cd32,ffff00,ff8c00,ff0000"}, 'check')

print(ui.Chart.image.series(sstMonthly, BIOT, ee.Reducer.mean(), 500));
然而,我得到了一个图表错误。所有其他方面似乎都运转良好

Error generating chart: No features contain non-null values of 
"system:time_start".

我不太确定这个错误是什么,或者我遗漏了什么。我刚刚学习了教程中的基本代码。我对GEE很陌生,那里没有太多的研讨会或论坛,非常感谢您的帮助。

错误意味着:图像集合中的每个图像(
sstmonly
)都没有
系统:time\u start
属性或此属性的值为
null
。默认情况下,序列图需要此属性才能知道每个图像在序列图中的位置

关于您提供的
temporalCollection
函数,此函数创建的每个图像都没有
system:time\u start
属性。这是很自然的,因为通过减少图像采集而创建的任何图像在默认情况下都不会有
system:time\u start
(因为GEE不知道分配给它的时间)

有几种方法可以解决此问题,具体取决于您希望在系列图表的水平轴上显示的值

如果您只想显示当月拍摄的第一张图像的日期,只需在
temporalCollection
功能代码末尾添加一行即可:

    return collection.filterDate(startDate, endDate)
      .reduce(ee.Reducer.mean().combine({
        reducer2: ee.Reducer.minMax(),
        sharedInputs: true
      }))
      .set('system:time_start', startDate.millis());

这会将缩小图像的
system:time\u start
属性设置为与
startDate
相同的值。您的系列图表现在应该可以正常工作。

错误意味着:图像集合中的每个图像(
sstmonly
)都没有
系统:time\u start
属性,或者此属性的值为
null
。默认情况下,序列图需要此属性才能知道每个图像在序列图中的位置

关于您提供的
temporalCollection
函数,此函数创建的每个图像都没有
system:time\u start
属性。这是很自然的,因为通过减少图像采集而创建的任何图像在默认情况下都不会有
system:time\u start
(因为GEE不知道分配给它的时间)

有几种方法可以解决此问题,具体取决于您希望在系列图表的水平轴上显示的值

如果您只想显示当月拍摄的第一张图像的日期,只需在
temporalCollection
功能代码末尾添加一行即可:

    return collection.filterDate(startDate, endDate)
      .reduce(ee.Reducer.mean().combine({
        reducer2: ee.Reducer.minMax(),
        sharedInputs: true
      }))
      .set('system:time_start', startDate.millis());
这会将缩小图像的
system:time\u start
属性设置为与
startDate
相同的值。您的系列图表现在应该可以正常工作了