Location:
var roi = /* color: #d63000 */ee.Geometry.Point([-71.97203347683796, -13.529827050320447]);
Collection:
var collection = ee.ImageCollection('COPERNICUS/S2')
.filter(ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE", 10))
.filterDate('2018-01-1' ,'2018-12-31')
.filterBounds(roi)
Calculte NDVI
function addNDVI(image) {
var a = image.normalizedDifference(['B8', 'B4']);
return image.addBands(a);
}
var ndvi2 = collection.map(addNDVI)
var ndvi2 = ndvi2.qualityMosaic('nd');
Now i want to reclass the NDVI raster in interal [-1-0.2], [0.2-0.4], [0.4-0.6], [0.6-0.8],[0.8-1],i try this code
var ndvireclass = ndvi2.select("nd").divide(10).ceil();
Map.addLayer(ndvireclass, {bands:'nd', min: 0, max: 1, gamma: 1.5}, 'NDVI reclass');
But the result image have only 2 clasess -1 and 1