Hi @meteoclima,
Sorry, there was a typo in @dorothyrono’s code: it is missing the parameter that sets the output number of bands, which in this case should be 1.
If you try the following Evalscript, it should work (see example):
//VERSION=3
function setup() {
return {
input: ["B08", "B04"],
output: { bands: 1 }
};
}
function evaluatePixel(sample) {
var ndvi = (sample.B08 - sample.B04) / (sample.B08 + sample.B04);
return [ndvi];
}
Note: this script in itself is designed for display purposes (scaled to the range 0-255). However, when you select Image format: TIFF (32-bit float)
in the download section of EO Browser (under Analytical
) the system will retrieve the raw values in Float for you.