I would like to calculate the SD of a NDVI value by pixel over a time series using Sentinel 2. It is to identify pixels with more or less variations over a specific time period. The expected output would be a collection of images where pixels values are SD,mean, Min MAX, etc.
What I've done so far is :
//Import GEE Feature Collection
var ROI = ee.FeatureCollection('https://code.earthengine.google.com/?asset=users/floriangirond/multiplearea');
// Create image collection of S-2 imagery for the perdiod 2018-2019
var S2 = ee.ImageCollection('COPERNICUS/S2')
//filter start and end date
.filterDate('2018-01-01', '2018-12-31')
//filter according to drawn boundary
.filterBounds(ROI);
// Function to mask cloud from built-in quality band
// information on cloud
var maskcloud1 = function(image) {
var QA60 = image.select(['QA60']);
return image.updateMask(QA60.lt(1));
};
// Function to calculate and add an NDVI band
var addNDVI = function(image) {
return image.addBands(image.normalizedDifference(['B8', 'B4']));
};
// Add NDVI band to image collection
var S2 = S2.map(addNDVI);
// Extract NDVI band and create NDVI median composite image
var NDVI = S2.select(['nd']);
var NDVI = ee.FeatureCollection(NDVI.map(mapfunc));
var reducer1 = ee.Reducer.mean();
var reducers = reducer1.combine({reducer2: ee.Reducer.median(), sharedInputs: true})
.combine({reducer2: ee.Reducer.max(), sharedInputs: true})
.combine({reducer2: ee.Reducer.min(), sharedInputs: true})
.combine({reducer2: ee.Reducer.stdDev(), sharedInputs: true});
var results = NDVI.reduceRegion({reducer: reducers,
geometry: ROI,
bestEffort: true});
print(results);