GEE:MODIS计算生物量

  • Post author:
  • Post category:其他


本文记录在Google Earth Engine(GEE)平台上通过NPP和GPP数据来计算生物量。

数据集合:

NPP【MODIS/006/MOD17A3H】

GPP【MODIS/006/MYD17A2H】



一、结果展示:

以三峡库区为例,计算其生物量,并打印均值折线图。



打印生物量均值折线图





二、代码实现

//加载矢量,然后直接运行
var roi = table.geometry();

// 设置地图中心和加载矢量
Map.centerObject(roi, 5);
//Map.addLayer(roi,false,"roi");

var nppDataset = ee.ImageCollection("MODIS/006/MOD17A3H")
var gppDataset = ee.ImageCollection("MODIS/006/MYD17A2H")

// 时间定义
var startdate = ee.Date.fromYMD(2006,1,1);
var enddate = ee.Date.fromYMD(2012,12,31);

// 按时间筛选npp和gpp
var nppCollection = nppDataset.filterDate(startdate, enddate)
                              .select("Npp");
                       
var gppCollection = gppDataset.filterDate(startdate, enddate)
                              .select("Gpp");

// 计算npp
var myNpp = function(myimg){
     var d = ee.Date(myimg.get('system:time_start'))
     var y = d.get('year').toInt();
     // 分别计算GPP和NPP,对影像进行筛选
     var GPPy = ee.Image(gppCollection.filter(ee.Filter.calendarRange(y, y, 'year')).sum());
     var NPPy = ee.Image(nppCollection.filter(ee.Filter.calendarRange(y, y, 'year')).mean());
     var npp8 = myimg.expression('(GGP8 / GPPy) * NPPy', 
    {
        GGP8: myimg,
        GPPy: GPPy,
        NPPy: NPPy
    });
  
  var out = npp8.copyProperties(myimg,['system:time_start']);
  return out;  

}

var npp8Collection = ee.ImageCollection(gppCollection.map(myNpp));

// 计算生物量

var Biomass = function(myimg){
var biomass = myimg.multiply(2.5);
return biomass.copyProperties(myimg,['system:time_start']);
}

// 遍历影像
var biomassCollection = npp8Collection.map(Biomass);

// 可视化参数
var biomass_viz = {min:100.0, max:800, palette: 'FFFFFF, CE7E45, DF923D, F1B555, FCD163, 99B718, 74A901, 66A000, 529400,' +
   '3E8601, 207401, 056201, 004C00, 023B01, 012E01, 011D01, 011301'};

// 加载影像
Map.addLayer(biomassCollection.mean().clip(roi),biomass_viz,"npp_redsoil_region")

// 定义山西chart的属性
var title = {
  title: 'Biomass production in redsoil region',
  hAxis: {title: 'Time'},
  vAxis: {title: 'Biomass (kg/m2)'},
};

print(biomassCollection)

// 创建chart
var biomassChart = ui.Chart.image.seriesByRegion(biomassCollection,
                        roi,
                        ee.Reducer.mean(),
                        'Gpp',
                        100000,
                        'system:time_start').setOptions(title);
//打印到生物量图
print(biomassChart)



版权声明:本文为qq_35591253原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。