基于GEE(Google earth engine)的 GIMMS NDVI月合成

这里写自定义目录标题

动机

项目需要用到长时间序列的NDVI数据,一般人常用到的是MODIS的月合成产品,而忽略了GIMMS,是因为其空间分辨率低;但是其依然具有其他产品无法比拟的优势,那就是时间序列长。并且SPOT的时间序列也要比MODIS早。参考链接与代码链接在文末尾标注可以查看。

代码

在我看到过一个帖子,也很好,但是他月合成的方式,有点问题,直接把每个月都算成28天去合成。在月尺度和28天尺度上最大值合成。虽然结果差不多吧,但是我心里上还是不能接受;一直使用代码解决问题的思想,让我坚信能用月合成,而不是28天,所以我简单搜了下,找到的解决方案,希望给后面遇到同样苦难的同学提供解决思路。
废话不多说,直接贴代码。



// //显示边界 
// 这里构建空的Image,然后通过palette设置边界颜色
var empty = ee.Image().toByte();

var outline = empty.paint({
  featureCollection:MBR_HB,  // 筛选的colletion
  color:0, //颜色透明
  width:1  //边界宽度
});
// Map.addLayer(Hulunbuir, {palette: "ff0000"},'Hulunbuir');

Map.addLayer(MBR_HB, {palette: "ff0000"},'MBR_HB');

print(imageCollection);

var years = ee.List.sequence(1981, 2013);
var months = ee.List.sequence(1, 12);

var map_m = function(i) {
  i = ee.Number(i);
  var filtered_col = years.map(function(j) {
    var filtered = imageCollection
        .filter(ee.Filter.calendarRange(i, i, 'month'))
        .filter(ee.Filter.calendarRange(j, j, 'year'))
        .select('ndvi')
        .max();
    return filtered;
  });
  return filtered_col;
};

var img_col = ee.ImageCollection(months.map(map_m).flatten());

print(img_col);

// var checkImage = ee.Image(img_col.filter(ee.Filter.eq('system:index', '10')).first());

// print(checkImage);

// Map.addLayer(checkImage, {min:-1,max:1}, 'test');


// var indexs = ee.List.sequence(0, 395);
for(var i=0;i<=3;i++){
  var checkImage = ee.Image(img_col.filter(ee.Filter.eq('system:index', String(i))).first()).clip(MBR_HB);
  print(checkImage);
  
  
  Map.addLayer(checkImage, {min:-1,max:1},"ndvi_index_"+i);

  Export.image.toDrive({
      image: checkImage,
      description: "index_"+i,
      crs: "EPSG:4326",
      // scale: 1000,
      region: MBR_HB,
      maxPixels: 1e13,
      folder: 'Hulunbuir'
      
    });
}

参考的帖子
https://gis.stackexchange.com/questions/279622/writing-code-for-monthly-ndvi-medians-in-google-earth-engine
我的GEE分享链接
https://code.earthengine.google.com/?scriptPath=users%2F1363989042%2FCannabis_Sentinel2%3ANDVI%2FGIMMS_Download

  • 3
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值