想要实现的功能:统计单幅栅格图像的数据统计,例如最大值,最小值,均值,value分布。
在网络上搜了很多方法,发现最方便的还是使用chart
// Define the chart and print it to the console.
var chart =
ui.Chart.image.histogram({image: FormaTrend, region: roi, scale: 1000})
.setSeriesNames(['long-trend', 'long-tstat', 'short-trend','hansen-stat'])
.setOptions({
title: ' Histogram',
maxPixels: 1e13,
hAxis: {
title: 'Reflectance (scaled by 1e4)',
titleTextStyle: {italic: false, bold: true},
},
vAxis:
{title: 'Count', titleTextStyle: {italic: false, bold: true}},
colors: ['cf513e', '1d6b99', 'f0af07','cf578e']
});
print(chart);
1.maxPixels必须要设置,否则会报错。
2.scalez的设置不同会影响结果
scale5000
scale1000, 明显出现了异常值