fix: add NDWI water mask to evalscripts (S2 + S3) to exclude land pixels
This commit is contained in:
@@ -145,7 +145,7 @@ class SentinelHubClient
|
||||
//VERSION=3
|
||||
function setup() {
|
||||
return {
|
||||
input: [{ bands: ["B04", "B08", "B11", "CLP"], units: "REFLECTANCE" }],
|
||||
input: [{ bands: ["B03", "B04", "B08", "B11", "CLP"], units: "REFLECTANCE" }],
|
||||
output: { bands: 1, sampleType: "UINT8" }
|
||||
};
|
||||
}
|
||||
@@ -153,6 +153,10 @@ function setup() {
|
||||
function evaluatePixel(sample) {
|
||||
if (sample.CLP > 0.4) { return [255]; } // nodata : nuage
|
||||
|
||||
// Masque eau : NDWI = (Green - NIR) / (Green + NIR) — terre si <= 0
|
||||
const ndwi = (sample.B03 - sample.B08) / (sample.B03 + sample.B08);
|
||||
if (ndwi <= 0) { return [0]; }
|
||||
|
||||
const lambdaRed = 664.5;
|
||||
const lambdaNir = 832.8;
|
||||
const lambdaSwir = 1613.7;
|
||||
@@ -178,16 +182,19 @@ EVALSCRIPT;
|
||||
//VERSION=3
|
||||
function setup() {
|
||||
return {
|
||||
input: [{ bands: ["B08", "B11", "B17"], units: "REFLECTANCE" }],
|
||||
input: [{ bands: ["B06", "B08", "B11", "B17"], units: "REFLECTANCE" }],
|
||||
output: { bands: 1, sampleType: "UINT8" }
|
||||
};
|
||||
}
|
||||
|
||||
function evaluatePixel(sample) {
|
||||
// Masque eau : NDWI = (Green B06 560nm - NIR B17 865nm) / (Green + NIR)
|
||||
const ndwi = (sample.B06 - sample.B17) / (sample.B06 + sample.B17);
|
||||
if (ndwi <= 0) { return [0]; }
|
||||
|
||||
const lambdaRed = 665.0;
|
||||
const lambdaRedEdge = 708.75;
|
||||
const lambdaNir = 865.0;
|
||||
const ratio = (lambdaNir - lambdaRed) / (lambdaRedEdge - lambdaRed);
|
||||
|
||||
// MCI : baseline interpolée entre Red et RedEdge
|
||||
const baseline = sample.B08 + (sample.B11 - sample.B08) * (lambdaNir - lambdaRed) / (lambdaRedEdge - lambdaRed);
|
||||
|
||||
Reference in New Issue
Block a user