十五
le: \''Regular NDVI Time Series\'',
interpolateNulls: false,
vAxis: {title: \''NDVI\'', viewWindow: {min: 0, max: 1}},
hAxis: {title: \''\'', format: \''YYYY-MM\''},
lineWidth: 1,
pointSize: 4,
series: {
0: {color: \''#238b45\''},
},
})
print(chart);
print(\''Interpolated Collection\'', interpolatedCol)
//第五步:把插出来的数据进行SG滤波。
var oeel=require(\''users/OEEL/lib:loadAll\'');
// https://www.open-geocomputing.org/OpenEarthEngineLibrary/#.ImageCollection.SavatskyGolayFilter
//进行sg滤波处理
var maxDiffFilter = ee.Filter.maxDifference({
difference: millis,
leftField: \''system:time_start\'',
rightField: \''system:time_start\''
})
var distanceFunction = function(infromedImage, estimationImage) {
return ee.Image.constant(
ee.Number(infromedImage.get(\''system:time_start\''))
.subtract(
ee.Number(estimationImage.get(\''system:time_start\'')))
);
}
// 把SG滤波函数设置为三次函数
var order = 3;
var smoothed = oeel.ImageCollection.SavatskyGolayFilter(
interpolatedCol,
maxDiffFilter,
distanceFunction,
order)
//选择d_0_ndvi波段并重命名
var smoothed = smoothed.select([\''d_0_ndvi\''], [\''smoothed\''])
//第六步:数据可视化
//定义曲线标题
var title = \''Savitsky-Golay smoothing\'' +
\''(order = \''+ order + \'', window_size = \'' + days + \'')\''
// 把原始的和经过SG滤波的数据NDVI曲线画出来
var chart = ui.Chart.image.series({
imageCollection: ndviCol.merge(smoothed),
region: geometry,
reducer: ee.Reducer.mean(),
scale: 20
}).setOptions({
lineWidth: 1,
title: title,
interpolateNulls: true,
vAxis: {title: \''NDVI\''},
hAxis: {title: \''\'', format: \''YYYY-MMM\''},
series: {
0: {color: \''blue\'', lineWidth: 1,
l