使用 Google Earth Engine 将 Landsat Image Collection 缩减为长格式列表时缺少 NDVI 值
Missing NDVI values when reducing Landsat Image Collection to long format list using Google Earth Engine
我想将 landsat 时间序列的 NDVI 值作为要素集合,以将这些值导出为 CSV 格式的长格式 table。我使用 Hansen Global Forest Change 数据集和 Landsat 7 时间序列。全球森林变化数据集被转换为特征集合以指定感兴趣的区域。
Landsat 7 时间序列用于获取随时间变化的 NDVI 值。
将landsat NDVI时间序列转换为要素集合后,没有出现NDVI值。将时间序列转换为三元组仅出现 'image 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();
我找到了缺少的命令:
减少后必须使用“.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();
我想将 landsat 时间序列的 NDVI 值作为要素集合,以将这些值导出为 CSV 格式的长格式 table。我使用 Hansen Global Forest Change 数据集和 Landsat 7 时间序列。全球森林变化数据集被转换为特征集合以指定感兴趣的区域。 Landsat 7 时间序列用于获取随时间变化的 NDVI 值。
将landsat NDVI时间序列转换为要素集合后,没有出现NDVI值。将时间序列转换为三元组仅出现 'image 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();
我找到了缺少的命令: 减少后必须使用“.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();