I'm having a little bit of trouble reducing the NDVI band of my data, without reducing the time bands. What I want is to apply a 95th percentile reducer to the NDVI band of my image from Colorado and have the time stamp from the pixels that were selected for the composite image to carry over, but instead I am reducing BOTH the NDVI and system:time_start band.
//ADD QUALITY BANDS TO MAKE GREENEST PIXEL MOSAIC FOR LANDSAT 5
//This function masks clouds in Landsat 5 imagery.
var maskClouds = function(image) {
var scored = ee.Algorithms.Landsat.simpleCloudScore(image);
return image.updateMask(scored.select(['cloud']).lt(20));
};
//This function masks clouds and adds quality bands to Landsat 8 images.
var addQualityBand = function(image) {
return maskClouds(image)
//NDVI
.addBands(image.normalizedDifference(['B4', 'B3']))
//time in days
.addBands(image.metadata('system:time_start'));
};
var addTime = function(image) {
return image.addBands(image.metadata('system:time_start'));
};
// Map the function over the collection and display the result.
////print(collection.map(addTime));
//Map.addLayer(fldas_colorado_1990, {}, "max temp and precip data for 1990");
var collection_1990= ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
.filterDate('1990-1-1','1990-12-31')
.map(addQualityBand);
var only_NDVI_1990 = collection_1990.select('nd','system:time_start');
var ninety_five_percent_1990 = only_NDVI_1990.reduce(ee.Reducer.percentile([95])).clip(colorado);
Map.addLayer(ninety_five_percent_1990, imageVisParam, '1990 95');
Here is the link to my script. https://code.earthengine.google.com/2664f992629c656230c8a9b531644660
Very basically, I want to be able to reduce bands in images, without reducing the system:time_start band, but still have the data from the reduced pixels carry over. Is this possible?
Thanks so much.