GEE12:按年合成数据,获取年总GPP图像

1.前提

由于某些数据的时间分辨率为8天或者16天,然而我们需要了解他的年总值或者均值,因此需要将整年的数据进行计算,为了方便起见,在GEE平台上进行操作,可以避免下载大量的数据到本地。

2. 以MOD17A2H.006数据为例(MOD17A2H.006: Terra Gross Primary Productivity 8-Day Global 500M 500m)

在这里插入图片描述

数据描述:
The MOD17A2H V6 Gross Primary Productivity (GPP) product is a cumulative 8-day composite with a 500m resolution. The product is based on the radiation-use efficiency concept and can be potentially used as inputs to data models to calculate terrestrial energy, carbon, water cycle processes, and biogeochemistry of vegetation.

数据波段:
在这里插入图片描述
该数据为8天合成数据

GEE code:

// 设置感兴趣区域
var geometry = table.geometry();
Map.centerObject(geometry, 5);
Map.addLayer(geometry, {
    
    color: "black"}, "ROI")

// 加载 MODIS/006/MOD17A2H 数据集
var dataset = ee.ImageCollection("MODIS/006/MOD17A2H").select('Gpp');

var gppVis = {
    
    
  min: 0,
  max: 600,
  palette: ['bbe029', '0a9501', '074b03'],
};
//Map.addLayer(dataset.filterBounds(geometry), gppVis, 'GPP');


// 定义起始年份和结束年份
var startYear = 2001;
var endYear = 2004;

// 定义一个函数用于按年合成并导出影像
var exportYearlyComposite = function(year) {
    
    
  year = ee.Number(year);

  // 过滤特定年份的影像集合
  var yearCollection = dataset.filterBounds(geometry)
                       .filter(ee.Filter.calendarRange(year, year, 'year'));

  // 合成影像
  var yearImage = yearCollection.sum().multiply(0.1);

  // 设置导出参数
  var exportParams = {
    
    
    image: yearImage.toFloat(),
    description: 'modis_gpp_yearly_' + year.getInfo(),
    folder: 'Gpp',
    region: geometry,
    scale: 500,
    crs: "EPSG:4326",
    maxPixels: 1e13,
  };

  // 导出影像
  Export.image.toDrive(exportParams);
  print(exportParams)
  print(year)
  print(yearCollection)
};

// 遍历每个年份并导出影像
for (var year = startYear; year <= endYear; year++) {
    
    
  exportYearlyComposite(year);
}

主要函数介绍:
ee.Filter.calendarRange(year, year, ‘year’):
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/amyniez/article/details/131246819