He calculado el NDVI máximo para cada mes. pero no sé cómo puedo escribir este código a través de un bucle en Google Earth Engine?
enlace de código: https://code.earthengine.google.com/99fd025cdb0688dce74ea5fa0966a2c2
Map.centerObject(table);
Map.addLayer(table);
// ndvi jan
var jan = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-01-01','2018-02-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('jan');
// ndvi feb
var feb = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-02-01','2018-03-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('feb');
// ndvi mar
var mar = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-03-01','2018-04-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('mar');
// ndvi apr
var apr = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-04-01','2018-05-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('apr');
// ndvi may
var may = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-05-01','2018-06-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('may');
// ndvi jun
var jun = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-06-01','2018-07-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('jun');
// ndvi jul
var jul = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-07-01','2018-08-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('jul');
// ndvi aug
var aug = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-08-01','2018-09-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('aug');
// ndvi sep
var sep = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-09-01','2018-10-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('sep');
// ndvi oct
var oct = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-10-01','2018-11-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('oct');
// ndvi nov
var nov = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-11-01','2018-12-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('nov');
// ndvi dec
var dec = ee.ImageCollection("COPERNICUS/S3/OLCI")
.filterBounds(table)
.filterDate('2018-12-01','2019-01-01')
.map(function(img){
return img.normalizedDifference(['Oa17_radiance','Oa08_radiance']);
})
.max()
.clip(table)
.rename('dec');
var ndvistack = jan.addBands(feb).addBands(mar).addBands(apr).addBands(may)
.addBands(jun).addBands(jul).addBands(aug).addBands(sep).addBands(oct)
.addBands(nov).addBands(dec);