// Script provided by Dr. Andreas Braun within the SNAP forum on 2021-03-10 // Load basic variables (explained in previous sections) var start = ee.Date('2020-01-01'); var end = ee.Date('2020-12-31'); var point = ee.Geometry.Point([107.58, 16.47]); var colors = {min: 0, max: 4000, bands: ['B4', 'B3', 'B2']}; var S2 = ee.ImageCollection('COPERNICUS/S2'); var S2_filtered = S2 .filterDate(start,end) .filterBounds(point) .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 10)); Map.centerObject(point, 14); // Create a function which calculates the NDVI and adds it to a product var calculate_NDVI = function(func_image) { func_image = ee.Image(func_image); var ndvi_band = func_image.normalizedDifference(['B8', 'B4']).rename('NDVI_band'); return func_image.addBands(ndvi_band); }; // Calculate the NDVI for all images in the filtered collection var S2_NDVI = S2_filtered.map(calculate_NDVI); print('Image collection after mapping NDVI function', S2_NDVI); // Calculate the variation of the NDVI over the entire year 2020 var NDVI_2020 = S2_NDVI.select('NDVI_band').reduce(ee.Reducer.stdDev()); Map.addLayer(NDVI_2020, {min: 0.01, max: 0.28, palette: ['black', 'blue', 'yellow']}, "Standard deviation NDVI") // Create a temporal plot of the NDVI values of this point print(ui.Chart.image.series(S2_NDVI.select('NDVI_band'), point));