For my project, I am trying to obtain a single image for each month that represents the maximum NDVI value for that month across several years. So, basically I want 12 data points across the range of the source and print that to a chart. Right now I am able to print charts across small ranges of dates, but like I said previously I need one date per month that represents the maximum NDVI value across the entirety of Sentinel's collection. https://code.earthengine.google.com/38d25038f4c78cdd58b99279eff20271 https://code.earthengine.google.com/?asset=users/jspining/Wine_Districts

Here is my code so far:

var S2 = ee.ImageCollection('COPERNICUS/S2')

//filter start and end date
.filterDate('2018-09-01', '2018-10-31')

//filter according to drawn boundary

// 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 max composite image
var NDVI = S2.select(['nd']);
var NDVImax = NDVI.max(); 

// Create palettes for display of NDVI
var ndvi_pal = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b',
var plotNDVI = ui.Chart.image.doySeriesByYear(S2, table,ee.Reducer.max(),
'nd',500,'system:time_start', 'system:index')
                title: 'NDVI short-term time series',
                hAxis: {title: 'Date'},
                vAxis: {title: 'NDVI'}

// Display.

// Display NDVI results on map
Map.addLayer(NDVImax.clip(table), {min:0.0, max:0.9, palette: ndvi_pal}, 'NDVI');


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.