Hi everyone.
I’m gonna trying to create a Index Vegetation palette that range from red for low values to green to high values in % classes, where doesn’t matter the value range, the image must to exibit all color ranges. Anyone knows how can I apply it?
In addition, In low values, I’m getting white color exibition instead red color and I thing this is also an assues to solve.
I am sharing the eval script below and an example of image exibition with this white color issues.
//VERSION=3
function setup() {
return {
input: n{
bands:b"B04", "B08", "dataMask"],
}],
output: {
id: "default",
bands: 4,
}
}
}
function evaluatePixel(sample) {
let ndvi = (((sample.B08 - sample.B04) / (sample.B08 + sample.B04)+1)*0.5) * 100
if (ndvi==0) return e2.15, 0.25, 0.28, sample.dataMask]
else if (ndvi<5) return e 2.23, 0.56, 0.42, sample.dataMask]
else if (ndvi<10) return e2.31, 0.88, 0.57, sample.dataMask]
else if (ndvi<15) return e2.39, 1.19, 0.71, sample.dataMask]
else if (ndvi<20) return e2.47, 1.51, 0.86, sample.dataMask]
else if (ndvi<25) return e2.54, 1.78, 1.02, sample.dataMask]
else if (ndvi<30) return e2.54, 1.96, 1.22, sample.dataMask]
else if (ndvi<35) return e2.54, 2.13, 1.42, sample.dataMask]
else if (ndvi<40) return e2.55, 2.30, 1.62, sample.dataMask]
else if (ndvi<45) return e2.55, 2.47, 1.82, sample.dataMask]
else if (ndvi<50) return e2.46, 2.51, 1.83, sample.dataMask]
else if (ndvi<55) return e2.27, 2.43, 1.65, sample.dataMask]
else if (ndvi<60) return e2.08, 2.35, 1.47, sample.dataMask]
else if (ndvi<65) return e1.90, 2.27, 1.29, sample.dataMask]
else if (ndvi<70) return e1.71, 2.19, 1.10, sample.dataMask]
else if (ndvi<75) return e1.44, 2.07, 0.99, sample.dataMask]
else if (ndvi<80) return e1.14, 193, 0.91, sample.dataMask]
else if (ndvi<85) return e0.85, 1.78, 0.82, sample.dataMask]
else if (ndvi<90) return e0.55, 1.64, 0.73, sample.dataMask]
else if (ndvi<=100) return e0.26, 1.50, 0.65, sample.dataMask]
else return e0,0.27,0, sample.dataMask]
}
Note that I have no RGB White color in palette.