I have a ndvi series which I am able to plot using below code:
var ndvi = l8.map(function(image) {
return image.select().addBands(image.normalizedDifference(['B5', 'B4']));
});
var ndviChart = ui.Chart.image.series(ndvi, point, ee.Reducer.mean(), 500);
print(ndviChart);
My goal is to calculate the average ndvi for every 3 months window and then calculate the maximum ndvi over that 3 months window. How to access data in ui.Chart.series and is there any way by which I can do the above calculation on Google server ?
In javascript it can be done using
<script>
var lista = [22,4,5,6,11];
var maxAvg = 0.0;
for (var i = 0; i < lista.length - 2; i++) {
var avg = 0.0;
for (var j = 0; j < 3; j++) {
avg = avg + lista[i+j];
}
if (maxAvg < (avg/3.0)) {maxAvg = (avg/3.0)};
}
document.write(maxAvg);
</script>
I want to replace lista with ndviChart series. Can anybody help me in this direction?