I want to create a function that put any NDVI data range in all ramp color, doesn’t matter the interval of the values. In other hands, I’m trying to create a NDVI relative when all ramp color represent the value range. I’m just tried the blend method in utility functions, but did not work as I expected. After, I used my own logic to build a way to do this as follow in the function:
function evaluatePixel(sample) {
if ([3, 8, 9, 10].includes(sample.SCL) ){
return [1, 0, 0]
} else {
let ndvi = (sample.B08 - sample.B04) / (sample.B08 + sample.B04);
let min = Math.min.apply(ndvi);
let max = Math.max.apply(ndvi);
let ndviRelative = (ndvi - min) / (max - min);
return [...visualizer.process(ndviRelative), sample.dataMask]
Ignoring the dataMask and SCL samples, note that I’m trying to use “Math.min/max.apply()” method to extract de min and max values from ndvi and use this in the formula that’s normalize any NDVI data between 0 and 1 to then, vizualize in a ramp color. However, the return it’s been an image with a single data (in attach). My partiners suspect that I have to use updateOutputMetadata instead evaluatePixel. So, what should I have to do?