【问题标题】:Missing NDVI values when reducing Landsat Image Collection to long format list using Google Earth Engine使用 Google Earth Engine 将 Landsat Image Collection 缩减为长格式列表时缺少 NDVI 值
【发布时间】:2019-03-17 15:21:21
【问题描述】:

我希望将 landsat 时间序列的 NDVI 值作为特征集合,以将值导出为 CSV 中的长格式表。我使用 Hansen Global Forest Change 数据集和 Landsat 7 时间序列。全球森林变化数据集被转换为一个特征集合以指定感兴趣的区域。 Landsat 7 时间序列用于获取随时间变化的 NDVI 值。

将 landsat NDVI 时间序列转换为要素集合后,未出现 NDVI 值。将时间序列转换为三元组仅出现“图像 ID”和“timeMillis”。 我已经检查了数据类型(现在都是 int16)和投影(都是 EPSG:32638)。

如果有任何帮助,我将不胜感激。有什么我错过的吗?

var lossImage = ee.Image('UMD/hansen/global_forest_change_2017_v1_5')
  .select('lossyear')
  .clip(geometry);
var datamask = ee.Image('UMD/hansen/global_forest_change_2017_v1_5')
  .select('datamask')
  .clip(geometry);
// specifying int16 and EPSG equivalent to landsat
var noloss = lossImage
  .updateMask(lossImage.eq(0).and(datamask.eq(1)))
  .int16()
  .reproject('EPSG:32638', null, 30);
// create feat. collection to reduce regions of Landsat time series
var noloss_v = noloss.reduceToVectors({
  reducer: ee.Reducer.countEvery(),
  geometry: geometry,
  scale: scale
});
//// functions for Landsat
var addNDVI = function(image) {
  var ndvi = image.normalizedDifference(['B4', 'B3'])
    .rename('NDVI').int16();
  return image.addBands(ndvi);
};
var LS7 = ee.ImageCollection('LANDSAT/LE07/C01/T1_RT_TOA')
  .filterBounds(geometry)
  .filterDate('2005-01-01', '2015-12-31')
  .map(addNDVI)
  .select('NDVI');
//// Export LS NDVI 
var triplets = LS7.map(function(image) {
  return image.reduceRegions({
    collection: noloss_v.select('system:index'),
    reducer: ee.Reducer.mean().setOutputs(image.bandNames()),
    scale: 30,
  }).map(function(feature) {
    return feature.set({
      'imageID': image.id(),
      'timeMillis': image.get('system:time_start')
    });});
}).flatten();

【问题讨论】:

    标签: javascript google-earth-engine


    【解决方案1】:

    我找到了丢失的命令: 减少后必须使用“.filter(ee.Filter.neq('NDVI', null))”过滤0值

    var triplets = LS7.map(function(image){
      return image.reduceRegions({
    collection: noloss_v.select('system:index'),
    reducer: ee.Reducer.mean().setOutputs(image.bandNames()),
    scale: 30,
      }).filter(ee.Filter.neq('NDVI', null))
    .map(function(feature) {
    return feature.set({
      'imageID': image.id(),
      'timeMillis': image.get('system:time_start')
    });
    });
    }).flatten();
    

    【讨论】:

      猜你喜欢
      • 2019-02-02
      • 1970-01-01
      • 1970-01-01
      • 2023-01-18
      • 1970-01-01
      • 2016-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多