【问题标题】:How to plot scattered point of NDVI and draw the trend in google earth engine如何在google earth engine中绘制NDVI的散点并绘制趋势
【发布时间】:2023-01-18 08:23:35
【问题描述】:

我正在使用“USGS Landsat 8 Level 2, Collection 2, Tier 1”Landsat 来计算平均 NDVI 并根据散点图绘制趋势。

我使用了以下代码:

For importing file:
var imageCollection 'USGS Landsat 8 Level 2, Collection 2, Tier 1'
var Table 'the shapefile'


// Define a function that will add an NDVI band to a Landsat 8 image. 
var addNDVI = function(image) {
  var ndvi = image.normalizedDifference(['SR_B5', 'SR_B4']).rename('NDVI');
  return image.addBands(ndvi);
};


function add_NDVI_collection(image_IC){
  var NDVI_IC = table.map(addNDVI);
  return NDVI_IC;
}


// Filter and map the function over the collection.
var withNDVI = imageCollection.filterDate('2015-01', '2015-12')
    .map(addNDVI); // <-- map() the function over the collection.
    
    
// Filter and map the function over the collection.

// Make a chart.
var chart = ui.Chart.image.series({
  imageCollection: withNDVI.select('NDVI'), 
  region: table, //again, here the ROI is a single point
  reducer: ee.Reducer.mean()})

// Define custom options for the chart. See:
// https://developers.google.com/chart/interactive/docs/reference
var options = { 
  title: 'NDVI over time', 
  hAxis: { title: 'time' ,format: 'YYYY-MMM',gridlines:{count:12}},
  vAxis: { title: 'NDVI' },
  series: {
    0: { color: 'blue' }
  }
};

// Set the options of the chart and print it.
chart = chart.setOptions(options);
print(chart); // Put it in the console


我得到以下情节:

如何绘制散点而不是 NDVI 的连接线并通过去除异常值绘制趋势?

【问题讨论】:

    标签: google-earth-engine


    【解决方案1】:

    您可以使用这个tutorial 来完全控制您的图表。 为了平滑你的曲线:

    .setOptions({ 曲线类型:'函数' })

    用于显示点

    { 点数:10 }

    【讨论】:

      猜你喜欢
      • 2017-05-28
      • 2021-10-03
      • 2021-08-10
      • 1970-01-01
      • 2020-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-14
      相关资源
      最近更新 更多