【问题标题】:Error generating chart: No features contain non-null values of "system:time_start". Google earth engine生成图表时出错:没有特征包含“system:time_start”的非空值。谷歌地球引擎
【发布时间】:2018-07-26 15:41:26
【问题描述】:

我正在使用谷歌地球引擎,并且我使用了我在网上找到的一个名为 temporalCollection 的函数(单击here)来计算一年中的月平均值。然后我将它们显示在地图上,但也希望为它们制作图表。请参阅下面的代码。

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 很陌生,那里没有太多的研讨会或论坛,非常感谢任何帮助。

【问题讨论】:

    标签: charts error-handling time-series timeserieschart google-earth-engine


    【解决方案1】:

    错误的意思是:您的图像集合(sstMonthly)中的每个图像都没有system:time_start 属性或该属性的值为null。默认情况下,系列图表需要该属性才能知道每个图像在系列图表中的位置。

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

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

    如果只想显示当月拍摄的第一张图片的日期,只需在temporalCollection函数代码的末尾添加1行:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-25
      • 2023-04-03
      • 1970-01-01
      • 2019-01-05
      • 1970-01-01
      • 1970-01-01
      • 2013-08-02
      • 2022-01-13
      相关资源
      最近更新 更多