Google Earth Engine(GEE)——当我们前后影像来弥补插值效果得时候,没有效果怎么办?

最近发现了一个巨牛的人工智能学习网站,点击跳转到网站:前言 – 床长人工智能教程

这个代码就是当我们再对影像进行插值对去云的影像进行弥补的时候,很多时候影像出不来结果,所以我们要改变我们的插值影像的时间,这样增加影像的时间,以便更多的影像用于插值。代码:

// define Dates
var startDate = ee.Date('2003-01-01')
var endDate = ee.Date('2021-12-31')

// Define another mask function to create mask from SmmaryQA
var maskQA = function(image) {
  return image.updateMask(image.select("SummaryQA").eq(0)).multiply(0.0001)
  .copyProperties(image, ['system:time_start'])
};

// Function for clip using the boundary
var clip = function(image){
  return image.clip(ncr)
}

// Adding the MODIS 16 days NDVI collection and select NDVI, EVI, and DetailedQA: maskQA
var mask_col = ee.ImageCollection("MODIS/061/MYD13Q1")
                 .filterDate(ee.Date('2003-01-01'),ee.Date('2021-12-31'))
                 .filterBounds(ncr)
                 .select('NDVI', 'EVI', 'SummaryQA')
                 .map(maskQA)
                 .map(clip)
                 //.select('NDVI')

mask_col = mask_col.select('NDVI')
print(mask_col, 'original_masked_collection')

// selecting first NDVI and add to the map
// var image = ee.Image(filtered.first())
//           .select('NDVI')
// //             //.clip(ncr)

// Defing the palette for visualisation
var ndviVis = {min: 0, max: 0.7, palette: ['red', 'yellow', 'green', 'darkgreen']};
//Map.addLayer(image, ndviVis, 'ndvi')
Map.addLayer(mask_col.first().select('NDVI'), ndviVis, 'Mask1')

//##############################################################
// Step-2: Create an empty Time-Series images at n days interval
//##############################################################
// Select the interval. We will have 1 image every n days

var n = 16; // for repeativity of the date
var totalDays = endDate.difference(startDate, 'day');
var daysToInterpolate = ee.List.sequence(1, totalDays, n)
var initImages = daysToInterpolate.map(function(day) {
  var image = ee.Image().rename('NDVI').toFloat().set({
    'system:index': ee.Number(day).format('%d'),
    'system:time_start': startDate.advance(day, 'day').millis(),
    // Set a property so we can identify interpolated images
    'type': 'interpolated'
    
  })
  return image
})

var initCol 
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值