GEE学习笔记2——MODIS GPP产品时间序列趋势分析

var geometry = ee.FeatureCollection('projects/ee/assets/HLJ')
Map.addLayer(geometry)
var collection = ee.ImageCollection("MODIS/006/MOD17A2H")
                     .filterDate('2000-01-01', '2021-12-31')
                     .select("Gpp")
                     .map(function(image){
                       return image.multiply(0.0001).set(image.toDictionary(image.propertyNames()))
                     });
var years = ee.List.sequence(2000, 2021);
var collectYear = ee.ImageCollection(years
  .map(function(y) {
    var start = ee.Date.fromYMD(y, 1, 1);
    var end = start.advance(12, 'month');
    return collection.filterDate(start, end).reduce(ee.Reducer.mean()).float().set('system:time_start',y).set('year',y);
}));
print(collectYear)

var Yearly_chart = ui.Chart.image.series({
    imageCollection: collectYear.select('Gpp_mean'),
    region: geometry,
    reducer: ee.Reducer.mean(),
    scale: 500,
    xProperty: 'year',
    }).setOptions({
      interpolateNulls: true,
      lineWidth: 2,
      title: 'GPP Yearly Seires',
      vAxis: {title: 'GPP'},
      hAxis: {title: 'Date'},
      trendlines: { 0: {title: 'GPP_trend',type:'linear', showR2: true,  color:'red', visibleInLegend: true}}
    });
print(Yearly_chart);

结果如下图:

GEE学习笔记2——MODIS GPP产品时间序列趋势分析_第1张图片

 

你可能感兴趣的:(GEE学习笔记,javascript)