I am trying to download NDVI as 1 band with a Cloud mask. Esssentially I am trying to combine these two scripts and need some assistance.
Cloud mask
//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04", "CLM"],
output: { bands: 1 }
}
}
function evaluatePixel(sample) {
if (sample.CLM == 1) {
return [0.75 + sample.B04,
sample.B03,
sample.B02]
}
return [
2.5*sample.B04,
2.5*sample.B03,
2.5*sample.B02];
}
1 band NDVI
//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];
}
It does not have to be these two scripts specifically, but if anyone has any suggestions on how to effectively combine these two i’d appreciate it. Thank you!