diff --git a/sentinel-2/indexdb/id_1.js b/sentinel-2/indexdb/id_1.js index 6b0297b7..72f6e0aa 100644 --- a/sentinel-2/indexdb/id_1.js +++ b/sentinel-2/indexdb/id_1.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=1 // -let index = B11 / B12; -let min = 0.059; -let max = 17.133; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.133; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_104.js b/sentinel-2/indexdb/id_104.js index a9b8e9f7..f5f6e654 100644 --- a/sentinel-2/indexdb/id_104.js +++ b/sentinel-2/indexdb/id_104.js @@ -7,29 +7,74 @@ // // Initialize parameters -let a = 0.752; - -let index = B08 - a * B04; -let min = -0.244; -let max = 0.344; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.244; // Values below this appear as white (underflow) +var maxColorValue = 0.344; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.752; + + let index = sample.B08 - a * sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_109.js b/sentinel-2/indexdb/id_109.js index 3c37a362..71177e79 100644 --- a/sentinel-2/indexdb/id_109.js +++ b/sentinel-2/indexdb/id_109.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=109 // -let index = (B08 - B05) / (B08 + B04); -let min = -2.77; -let max = 0.736; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -2.77; // Values below this appear as white (underflow) +var maxColorValue = 0.736; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B05) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_11.js b/sentinel-2/indexdb/id_11.js index 3df5ec7c..6efd3b79 100644 --- a/sentinel-2/indexdb/id_11.js +++ b/sentinel-2/indexdb/id_11.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=11 // -let index = (B04 - B02) / B04; -let min = -16.339; -let max = 0.942; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -16.339; // Values below this appear as white (underflow) +var maxColorValue = 0.942; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B04 - sample.B02) / sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_110.js b/sentinel-2/indexdb/id_110.js index 78e61bc1..b8341907 100644 --- a/sentinel-2/indexdb/id_110.js +++ b/sentinel-2/indexdb/id_110.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=110 // -let index = (B08 / B04 - 1.0) / Math.sqrt(B08 / B04 + 1.0); -let min = -0.914; -let max = 3.759; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.914; // Values below this appear as white (underflow) +var maxColorValue = 3.759; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 / sample.B04 - 1.0) / Math.sqrt(sample.B08 / sample.B04 + 1.0); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_111.js b/sentinel-2/indexdb/id_111.js index f5213cf9..2bdd04ef 100644 --- a/sentinel-2/indexdb/id_111.js +++ b/sentinel-2/indexdb/id_111.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=111 // -let index = (Math.pow(B08, 2.0) - B04) / (Math.pow(B08, 2.0) + B04); -let min = -0.998; -let max = 0.683; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.998; // Values below this appear as white (underflow) +var maxColorValue = 0.683; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (Math.pow(sample.B08, 2.0) - sample.B04) / (Math.pow(sample.B08, 2.0) + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_12.js b/sentinel-2/indexdb/id_12.js index fd560ac9..42a28e54 100644 --- a/sentinel-2/indexdb/id_12.js +++ b/sentinel-2/indexdb/id_12.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=12 // -let index = B08 / B04; -let min = 0.059; -let max = 17.254; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.254; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_123.js b/sentinel-2/indexdb/id_123.js index 43c51cf5..f88e0f1f 100644 --- a/sentinel-2/indexdb/id_123.js +++ b/sentinel-2/indexdb/id_123.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=123 // -let index = B08 / B03; -let min = 0.058; -let max = 17.135; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.135; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_125.js b/sentinel-2/indexdb/id_125.js index ceeec9e5..537deba4 100644 --- a/sentinel-2/indexdb/id_125.js +++ b/sentinel-2/indexdb/id_125.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=125 // -let index = (0.1 * B08 - B04) / (0.1 * B08 + B04); -let min = -0.988; -let max = 0.264; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.988; // Values below this appear as white (underflow) +var maxColorValue = 0.264; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (0.1 * sample.B08 - sample.B04) / (0.1 * sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_128.js b/sentinel-2/indexdb/id_128.js index c8ae45d4..5f4f5673 100644 --- a/sentinel-2/indexdb/id_128.js +++ b/sentinel-2/indexdb/id_128.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=128 // -let index = B08 / B03 - 1.0; -let min = -0.942; -let max = 16.3; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.942; // Values below this appear as white (underflow) +var maxColorValue = 16.3; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B03 - 1.0; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_129.js b/sentinel-2/indexdb/id_129.js index 66067eec..787e171a 100644 --- a/sentinel-2/indexdb/id_129.js +++ b/sentinel-2/indexdb/id_129.js @@ -7,25 +7,69 @@ // // Initialize parameters -let MIDIR = 0.101; - -let index = Math.log(1.0 - (B08 - MIDIR)) / (-Math.log(1.0 - (B08 - MIDIR))); -let min = -1.0; -let max = -1.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -1.0; // Values below this appear as white (underflow) +var maxColorValue = -1.0; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let MIDIR = 0.101; + + let index = Math.log(1.0 - (sample.B08 - MIDIR)) / (-Math.log(1.0 - (sample.B08 - MIDIR))); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_130.js b/sentinel-2/indexdb/id_130.js index fc75f523..43baec9d 100644 --- a/sentinel-2/indexdb/id_130.js +++ b/sentinel-2/indexdb/id_130.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=130 // -let index = (B05 - B04) / (B05 + B04); -let min = -0.888; -let max = 0.887; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.888; // Values below this appear as white (underflow) +var maxColorValue = 0.887; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B05 - sample.B04) / (sample.B05 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_131.js b/sentinel-2/indexdb/id_131.js index 4d27e918..6cbf32bf 100644 --- a/sentinel-2/indexdb/id_131.js +++ b/sentinel-2/indexdb/id_131.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=131 // -let index = B08 / B05 - 1.0; -let min = -0.941; -let max = 16.113; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.941; // Values below this appear as white (underflow) +var maxColorValue = 16.113; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B05 - 1.0; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_132.js b/sentinel-2/indexdb/id_132.js index 4c542798..f6f13cbc 100644 --- a/sentinel-2/indexdb/id_132.js +++ b/sentinel-2/indexdb/id_132.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=132 // -let index = B08 / B05; -let min = 0.058; -let max = 17.154; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.154; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_134.js b/sentinel-2/indexdb/id_134.js index 8b177ae1..ffe045ec 100644 --- a/sentinel-2/indexdb/id_134.js +++ b/sentinel-2/indexdb/id_134.js @@ -7,32 +7,77 @@ // // Initialize parameters -let y = 0.735; -let Rr = 0.740; -let L = 0.487; -let RB = 0.560; - -let index = (1.0 + L) * (B08 - (Rr - y * (RB - Rr))) / (B08 + -(Rr - y * (RB - Rr)) + L); -let min = -46.647; -let max = 49.256; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -46.647; // Values below this appear as white (underflow) +var maxColorValue = 49.256; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let y = 0.735; + let Rr = 0.740; + let L = 0.487; + let RB = 0.560; + + let index = (1.0 + L) * (sample.B08 - (Rr - y * (RB - Rr))) / (sample.B08 + -(Rr - y * (RB - Rr)) + L); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_135.js b/sentinel-2/indexdb/id_135.js index a71d055a..1b87edaf 100644 --- a/sentinel-2/indexdb/id_135.js +++ b/sentinel-2/indexdb/id_135.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=135 // -let index = (B08 - B02) / (B08 + B02); -let min = -0.892; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.892; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B02) / (sample.B08 + sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_136.js b/sentinel-2/indexdb/id_136.js index 1df14705..d7a52aef 100644 --- a/sentinel-2/indexdb/id_136.js +++ b/sentinel-2/indexdb/id_136.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=136 // -let index = (0.1 * B08 - B02) / (0.1 * B08 + B02); -let min = -0.988; -let max = 0.258; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.988; // Values below this appear as white (underflow) +var maxColorValue = 0.258; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (0.1 * sample.B08 - sample.B02) / (0.1 * sample.B08 + sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_137.js b/sentinel-2/indexdb/id_137.js index b9519c02..94cb40a4 100644 --- a/sentinel-2/indexdb/id_137.js +++ b/sentinel-2/indexdb/id_137.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=137 // -let index = 700.0 + 40.0 * ((((B04 + B07) / 2.0) - B05) / (B06 - B05)); -let min = -425.302; -let max = 1865.673; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B06", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -425.302; // Values below this appear as white (underflow) +var maxColorValue = 1865.673; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 700.0 + 40.0 * ((((sample.B04 + sample.B07) / 2.0) - sample.B05) / (sample.B06 - sample.B05)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_138.js b/sentinel-2/indexdb/id_138.js index 190fb730..25d3f530 100644 --- a/sentinel-2/indexdb/id_138.js +++ b/sentinel-2/indexdb/id_138.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=138 // -let index = 702.0 + 40.0 * ((((B04 + B07) / 2.0) - B05) / (B06 - B05)); -let min = -425.467; -let max = 1867.294; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B06", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -425.467; // Values below this appear as white (underflow) +var maxColorValue = 1867.294; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 702.0 + 40.0 * ((((sample.B04 + sample.B07) / 2.0) - sample.B05) / (sample.B06 - sample.B05)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_139.js b/sentinel-2/indexdb/id_139.js index 41548506..90be5f05 100644 --- a/sentinel-2/indexdb/id_139.js +++ b/sentinel-2/indexdb/id_139.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=139 // -let index = 705.0 + 35.0 * ((((B04 + B07) / 2.0) - B05) / (B06 - B05)); -let min = -281.46; -let max = 1726.494; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B06", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -281.46; // Values below this appear as white (underflow) +var maxColorValue = 1726.494; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 705.0 + 35.0 * ((((sample.B04 + sample.B07) / 2.0) - sample.B05) / (sample.B06 - sample.B05)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_14.js b/sentinel-2/indexdb/id_14.js index ef5c56be..cc255764 100644 --- a/sentinel-2/indexdb/id_14.js +++ b/sentinel-2/indexdb/id_14.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=14 // -let index = B12 / B04; -let min = 0.057; -let max = 17.368; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.368; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_140.js b/sentinel-2/indexdb/id_140.js index 336fb7c6..06b8c53d 100644 --- a/sentinel-2/indexdb/id_140.js +++ b/sentinel-2/indexdb/id_140.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=140 // -let index = B05; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_142.js b/sentinel-2/indexdb/id_142.js index 817279e4..6e567601 100644 --- a/sentinel-2/indexdb/id_142.js +++ b/sentinel-2/indexdb/id_142.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=142 // -let index = (B05 / B04) * (Math.sqrt(Math.pow(((B05 - B03) / 150.0 * 670.0 + B04 + (B03 - ((B05 - B03) / 150.0 * 550.0))), 2.0))) / (Math.pow(((B05 - B03) / Math.pow(150.0, 2.0) + 1.0), 0.5)); -let min = 0.018; -let max = 5.295; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.018; // Values below this appear as white (underflow) +var maxColorValue = 5.295; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B05 / sample.B04) * (Math.sqrt(Math.pow(((sample.B05 - sample.B03) / 150.0 * 670.0 + sample.B04 + (sample.B03 - ((sample.B05 - sample.B03) / 150.0 * 550.0))), 2.0))) / (Math.pow(((sample.B05 - sample.B03) / Math.pow(150.0, 2.0) + 1.0), 0.5)); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_150.js b/sentinel-2/indexdb/id_150.js index d3af49f3..dca1e5bf 100644 --- a/sentinel-2/indexdb/id_150.js +++ b/sentinel-2/indexdb/id_150.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=150 // -let index = (B08 - B05) / (B08 - B04); -let min = -32.692; -let max = 33.539; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -32.692; // Values below this appear as white (underflow) +var maxColorValue = 33.539; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B05) / (sample.B08 - sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_151.js b/sentinel-2/indexdb/id_151.js index 421c6404..904e5f46 100644 --- a/sentinel-2/indexdb/id_151.js +++ b/sentinel-2/indexdb/id_151.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=151 // -let index = B08 / B05; -let min = 0.059; -let max = 17.142; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.142; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_153.js b/sentinel-2/indexdb/id_153.js index 40a413fd..2815f7d6 100644 --- a/sentinel-2/indexdb/id_153.js +++ b/sentinel-2/indexdb/id_153.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=153 // -let index = B04 / (B03 * B05); -let min = 0.253; -let max = 208.643; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.253; // Values below this appear as white (underflow) +var maxColorValue = 208.643; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / (sample.B03 * sample.B05); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_154.js b/sentinel-2/indexdb/id_154.js index 95d295ee..6b2aad61 100644 --- a/sentinel-2/indexdb/id_154.js +++ b/sentinel-2/indexdb/id_154.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=154 // -let index = B04 / B03; -let min = 0.058; -let max = 17.272; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.272; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_155.js b/sentinel-2/indexdb/id_155.js index 9b3555c6..c3c89a1f 100644 --- a/sentinel-2/indexdb/id_155.js +++ b/sentinel-2/indexdb/id_155.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=155 // -let index = B8A / (B03 * B05); -let min = 0.256; -let max = 207.696; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B05", "B8A", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.256; // Values below this appear as white (underflow) +var maxColorValue = 207.696; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B8A / (sample.B03 * sample.B05); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_16.js b/sentinel-2/indexdb/id_16.js index a1290aeb..0ddfe0d3 100644 --- a/sentinel-2/indexdb/id_16.js +++ b/sentinel-2/indexdb/id_16.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=16 // -let index = 2.5 * (B08 - B04) / ((B08 + 6.0 * B04 - 7.5 * B02) + 1.0); -let min = -8.155; -let max = 7.894; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -8.155; // Values below this appear as white (underflow) +var maxColorValue = 7.894; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 2.5 * (sample.B08 - sample.B04) / ((sample.B08 + 6.0 * sample.B04 - 7.5 * sample.B02) + 1.0); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_164.js b/sentinel-2/indexdb/id_164.js index 9c2a3d7a..0f3345ee 100644 --- a/sentinel-2/indexdb/id_164.js +++ b/sentinel-2/indexdb/id_164.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=164 // -let index = (B08 - B04) / (B08 + B04 - 2.0 * B01); -let min = -16.52; -let max = 16.491; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -16.52; // Values below this appear as white (underflow) +var maxColorValue = 16.491; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04 - 2.0 * sample.B01); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_166.js b/sentinel-2/indexdb/id_166.js index 58819889..a88e73ee 100644 --- a/sentinel-2/indexdb/id_166.js +++ b/sentinel-2/indexdb/id_166.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=166 // -let index = (B07 - B05) / (B07 - B04); -let min = -33.128; -let max = 33.474; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -33.128; // Values below this appear as white (underflow) +var maxColorValue = 33.474; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B07 - sample.B05) / (sample.B07 - sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_167.js b/sentinel-2/indexdb/id_167.js index 9a3c95b5..843d8bba 100644 --- a/sentinel-2/indexdb/id_167.js +++ b/sentinel-2/indexdb/id_167.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=167 // -let index = (B08 - B01) / (B04 - B01); -let min = -32.943; -let max = 32.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -32.943; // Values below this appear as white (underflow) +var maxColorValue = 32.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B01) / (sample.B04 - sample.B01); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_176.js b/sentinel-2/indexdb/id_176.js index 202ea046..e8c86b45 100644 --- a/sentinel-2/indexdb/id_176.js +++ b/sentinel-2/indexdb/id_176.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=176 // -let index = B08 / B04; -let min = 0.06; -let max = 17.896; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.06; // Values below this appear as white (underflow) +var maxColorValue = 17.896; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_18.js b/sentinel-2/indexdb/id_18.js index 440592dc..778f4714 100644 --- a/sentinel-2/indexdb/id_18.js +++ b/sentinel-2/indexdb/id_18.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=18 // -let index = B12 / B08 + B03 / B04; -let min = 0.359; -let max = 23.837; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.359; // Values below this appear as white (underflow) +var maxColorValue = 23.837; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12 / sample.B08 + sample.B03 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_180.js b/sentinel-2/indexdb/id_180.js index 0df49a15..3b975164 100644 --- a/sentinel-2/indexdb/id_180.js +++ b/sentinel-2/indexdb/id_180.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=180 // -let index = B05 / B04; -let min = 0.058; -let max = 16.547; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 16.547; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B05 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_181.js b/sentinel-2/indexdb/id_181.js index d09b6c2d..993cd76e 100644 --- a/sentinel-2/indexdb/id_181.js +++ b/sentinel-2/indexdb/id_181.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=181 // -let index = B04 / B05; -let min = 0.057; -let max = 16.975; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 16.975; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_185.js b/sentinel-2/indexdb/id_185.js index e9dce427..776e92ff 100644 --- a/sentinel-2/indexdb/id_185.js +++ b/sentinel-2/indexdb/id_185.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=185 // -let index = (B08 - (B03 + B04)) / (B08 + (B03 + B04)); -let min = -0.938; -let max = 0.527; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.938; // Values below this appear as white (underflow) +var maxColorValue = 0.527; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - (sample.B03 + sample.B04)) / (sample.B08 + (sample.B03 + sample.B04)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_186.js b/sentinel-2/indexdb/id_186.js index 0c14bfbe..5f2b767f 100644 --- a/sentinel-2/indexdb/id_186.js +++ b/sentinel-2/indexdb/id_186.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=186 // -let index = (B08 - (B03 + B02)) / (B08 + (B03 + B02)); -let min = -0.938; -let max = 0.529; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.938; // Values below this appear as white (underflow) +var maxColorValue = 0.529; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - (sample.B03 + sample.B02)) / (sample.B08 + (sample.B03 + sample.B02)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_187.js b/sentinel-2/indexdb/id_187.js index a5fb41cb..15fe050c 100644 --- a/sentinel-2/indexdb/id_187.js +++ b/sentinel-2/indexdb/id_187.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=187 // -let index = (B08 - (B04 + B02)) / (B08 + (B04 + B02)); -let min = -0.938; -let max = 0.528; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.938; // Values below this appear as white (underflow) +var maxColorValue = 0.528; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - (sample.B04 + sample.B02)) / (sample.B08 + (sample.B04 + sample.B02)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_188.js b/sentinel-2/indexdb/id_188.js index f6a26171..21a8b5af 100644 --- a/sentinel-2/indexdb/id_188.js +++ b/sentinel-2/indexdb/id_188.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=188 // -let index = (B08 - (B03 + B04 + B02)) / (B08 + (B03 + B04 + B02)); -let min = -0.957; -let max = 0.177; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.957; // Values below this appear as white (underflow) +var maxColorValue = 0.177; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - (sample.B03 + sample.B04 + sample.B02)) / (sample.B08 + (sample.B03 + sample.B04 + sample.B02)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_19.js b/sentinel-2/indexdb/id_19.js index 059e763b..8fdd535e 100644 --- a/sentinel-2/indexdb/id_19.js +++ b/sentinel-2/indexdb/id_19.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=19 // -let index = B04 / B03; -let min = 0.059; -let max = 17.402; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.402; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_191.js b/sentinel-2/indexdb/id_191.js index da3652ae..b1f80ca0 100644 --- a/sentinel-2/indexdb/id_191.js +++ b/sentinel-2/indexdb/id_191.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=191 // -let index = (3.0 * (B05 - B04) - 0.2 * (B05 - B03) * B05 / B04) / ((1.0 + 0.16) * (B08 - B04) / (B08 + B04 + 0.16)); -let min = -45.198; -let max = 46.958; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -45.198; // Values below this appear as white (underflow) +var maxColorValue = 46.958; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (3.0 * (sample.B05 - sample.B04) - 0.2 * (sample.B05 - sample.B03) * sample.B05 / sample.B04) / ((1.0 + 0.16) * (sample.B08 - sample.B04) / (sample.B08 + sample.B04 + 0.16)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_192.js b/sentinel-2/indexdb/id_192.js index 77c675d8..dc5bddf3 100644 --- a/sentinel-2/indexdb/id_192.js +++ b/sentinel-2/indexdb/id_192.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=192 // -let index = ((B05 - B04) - 0.2 * (B05 - B03) * (B05 / B04)) / ((1.0 + 0.16) * (B08 - B04) / (B08 + B04 + 0.16)); -let min = -14.522; -let max = 15.084; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -14.522; // Values below this appear as white (underflow) +var maxColorValue = 15.084; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((sample.B05 - sample.B04) - 0.2 * (sample.B05 - sample.B03) * (sample.B05 / sample.B04)) / ((1.0 + 0.16) * (sample.B08 - sample.B04) / (sample.B08 + sample.B04 + 0.16)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_196.js b/sentinel-2/indexdb/id_196.js index 130d6e27..f8838d45 100644 --- a/sentinel-2/indexdb/id_196.js +++ b/sentinel-2/indexdb/id_196.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=196 // -let index = 700.0 + 40.0 * (((B04 + B07) / 2.0) - B05) / (B06 - B05); -let min = -426.102; -let max = 1867.558; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B06", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -426.102; // Values below this appear as white (underflow) +var maxColorValue = 1867.558; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 700.0 + 40.0 * (((sample.B04 + sample.B07) / 2.0) - sample.B05) / (sample.B06 - sample.B05); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_197.js b/sentinel-2/indexdb/id_197.js index a42eb9a9..4d9ee977 100644 --- a/sentinel-2/indexdb/id_197.js +++ b/sentinel-2/indexdb/id_197.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=197 // -let index = (((B05 - B04) - 0.2 * (B05 - B03)) * (B05 / B04)) / (1.5 * (1.2 * (B08 - B03) - 2.5 * (B04 - B03)) / Math.sqrt(Math.pow((2.0 * B08 + 1.0), 2.0) - (6.0 * B08 - 5.0 * Math.sqrt(B04)) - 0.5)); -let min = -11.451; -let max = 18.26; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -11.451; // Values below this appear as white (underflow) +var maxColorValue = 18.26; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (((sample.B05 - sample.B04) - 0.2 * (sample.B05 - sample.B03)) * (sample.B05 / sample.B04)) / (1.5 * (1.2 * (sample.B08 - sample.B03) - 2.5 * (sample.B04 - sample.B03)) / Math.sqrt(Math.pow((2.0 * sample.B08 + 1.0), 2.0) - (6.0 * sample.B08 - 5.0 * Math.sqrt(sample.B04)) - 0.5)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_20.js b/sentinel-2/indexdb/id_20.js index 11369240..93dc07e4 100644 --- a/sentinel-2/indexdb/id_20.js +++ b/sentinel-2/indexdb/id_20.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=20 // -let index = B11 / B08; -let min = 0.06; -let max = 17.079; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.06; // Values below this appear as white (underflow) +var maxColorValue = 17.079; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_200.js b/sentinel-2/indexdb/id_200.js index e579c830..225c94eb 100644 --- a/sentinel-2/indexdb/id_200.js +++ b/sentinel-2/indexdb/id_200.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=200 // -let index = Math.sqrt(B08 / B04); -let min = 0.241; -let max = 4.135; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.241; // Values below this appear as white (underflow) +var maxColorValue = 4.135; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.sqrt(sample.B08 / sample.B04); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_202.js b/sentinel-2/indexdb/id_202.js index 4bc7f72b..b98b3fc5 100644 --- a/sentinel-2/indexdb/id_202.js +++ b/sentinel-2/indexdb/id_202.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=202 // -let index = Math.sqrt((B08 - B04) / (B08 + B04) + 0.5); -let min = 0.136; -let max = 1.182; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.136; // Values below this appear as white (underflow) +var maxColorValue = 1.182; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.sqrt((sample.B08 - sample.B04) / (sample.B08 + sample.B04) + 0.5); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_203.js b/sentinel-2/indexdb/id_203.js index e99186a9..b7782132 100644 --- a/sentinel-2/indexdb/id_203.js +++ b/sentinel-2/indexdb/id_203.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=203 // -let index = B04 / B02; -let min = 0.058; -let max = 17.432; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.432; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B02; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_205.js b/sentinel-2/indexdb/id_205.js index d3bcdc2d..d68bf1e5 100644 --- a/sentinel-2/indexdb/id_205.js +++ b/sentinel-2/indexdb/id_205.js @@ -7,25 +7,69 @@ // // Initialize parameters -let SWIRI = 0.887; - -let index = SWIRI / B08; -let min = 0.049; -let max = 42.291; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.049; // Values below this appear as white (underflow) +var maxColorValue = 42.291; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let SWIRI = 0.887; + + let index = SWIRI / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_209.js b/sentinel-2/indexdb/id_209.js index b2b587a3..6735c8d0 100644 --- a/sentinel-2/indexdb/id_209.js +++ b/sentinel-2/indexdb/id_209.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=209 // -let index = 1.22 * (B08 - 1.22 * B04 - 0.03) / (1.22 * B08 + B04 - 1.22 * 0.03 + 0.08 * (1.0 + Math.pow(1.22, 2.0))); -let min = -0.971; -let max = 0.575; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.971; // Values below this appear as white (underflow) +var maxColorValue = 0.575; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.22 * (sample.B08 - 1.22 * sample.B04 - 0.03) / (1.22 * sample.B08 + sample.B04 - 1.22 * 0.03 + 0.08 * (1.0 + Math.pow(1.22, 2.0))); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_21.js b/sentinel-2/indexdb/id_21.js index ee538ea2..f6efd588 100644 --- a/sentinel-2/indexdb/id_21.js +++ b/sentinel-2/indexdb/id_21.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=21 // -let index = B12 / B08 + B03 / B04; -let min = 0.359; -let max = 23.832; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.359; // Values below this appear as white (underflow) +var maxColorValue = 23.832; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12 / sample.B08 + sample.B03 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_210.js b/sentinel-2/indexdb/id_210.js index d8a65842..80809656 100644 --- a/sentinel-2/indexdb/id_210.js +++ b/sentinel-2/indexdb/id_210.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=210 // -let index = B01 / B03; -let min = 0.059; -let max = 17.058; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B03", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.058; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B01 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_212.js b/sentinel-2/indexdb/id_212.js index e4b8721b..2bcfed48 100644 --- a/sentinel-2/indexdb/id_212.js +++ b/sentinel-2/indexdb/id_212.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=212 // -let index = B08 / B03; -let min = 0.058; -let max = 17.311; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.311; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_213.js b/sentinel-2/indexdb/id_213.js index 5eea1036..d7d17d76 100644 --- a/sentinel-2/indexdb/id_213.js +++ b/sentinel-2/indexdb/id_213.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=213 // -let index = B04 / B03; -let min = 0.059; -let max = 17.007; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.007; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_214.js b/sentinel-2/indexdb/id_214.js index d7fcfd27..934a5697 100644 --- a/sentinel-2/indexdb/id_214.js +++ b/sentinel-2/indexdb/id_214.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=214 // -let index = 1.0 / B03 - 1.0 / B05; -let min = -64.354; -let max = 64.803; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -64.354; // Values below this appear as white (underflow) +var maxColorValue = 64.803; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.0 / sample.B03 - 1.0 / sample.B05; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_215.js b/sentinel-2/indexdb/id_215.js index 7b17b279..60259ff0 100644 --- a/sentinel-2/indexdb/id_215.js +++ b/sentinel-2/indexdb/id_215.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=215 // -let index = (Math.pow(B03, (-1.0)) - Math.pow(B05, (-1.0))) * B08; -let min = -14.739; -let max = 14.963; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -14.739; // Values below this appear as white (underflow) +var maxColorValue = 14.963; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (Math.pow(sample.B03, (-1.0)) - Math.pow(sample.B05, (-1.0))) * sample.B08; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_219.js b/sentinel-2/indexdb/id_219.js index 4e5df53b..e8b4974e 100644 --- a/sentinel-2/indexdb/id_219.js +++ b/sentinel-2/indexdb/id_219.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=219 // -let index = (B8A - B11) / (B8A + B11); -let min = -0.889; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B8A", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B8A - sample.B11) / (sample.B8A + sample.B11); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_22.js b/sentinel-2/indexdb/id_22.js index 4f523ba4..a22f0566 100644 --- a/sentinel-2/indexdb/id_22.js +++ b/sentinel-2/indexdb/id_22.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=22 // -let index = B12 / B11; -let min = 0.059; -let max = 17.424; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.424; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12 / sample.B11; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_223.js b/sentinel-2/indexdb/id_223.js index a861e27d..bc152bb4 100644 --- a/sentinel-2/indexdb/id_223.js +++ b/sentinel-2/indexdb/id_223.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=223 // -let index = (B08 - B05) / (B08 + B05); -let min = -0.887; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.887; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B05) / (sample.B08 + sample.B05); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_224.js b/sentinel-2/indexdb/id_224.js index cb9df84f..8032476d 100644 --- a/sentinel-2/indexdb/id_224.js +++ b/sentinel-2/indexdb/id_224.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=224 // -let index = ((B08 - B05) / (B08 + B05)) / ((B08 - B04) / (B08 + B04)); -let min = -32.988; -let max = 32.84; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -32.988; // Values below this appear as white (underflow) +var maxColorValue = 32.84; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((sample.B08 - sample.B05) / (sample.B08 + sample.B05)) / ((sample.B08 - sample.B04) / (sample.B08 + sample.B04)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_227.js b/sentinel-2/indexdb/id_227.js index eecea0f5..fbf9c103 100644 --- a/sentinel-2/indexdb/id_227.js +++ b/sentinel-2/indexdb/id_227.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=227 // -let index = B08 / B02; -let min = 0.058; -let max = 17.001; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.001; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B02; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_237.js b/sentinel-2/indexdb/id_237.js index d1fd895e..a4b84fc4 100644 --- a/sentinel-2/indexdb/id_237.js +++ b/sentinel-2/indexdb/id_237.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=237 // -let index = 2.4 * (B08 - B04) / (B08 + B04 + 1.0); -let min = -0.571; -let max = 0.574; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.571; // Values below this appear as white (underflow) +var maxColorValue = 0.574; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 2.4 * (sample.B08 - sample.B04) / (sample.B08 + sample.B04 + 1.0); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_240.js b/sentinel-2/indexdb/id_240.js index 42a7ec77..d71dcc21 100644 --- a/sentinel-2/indexdb/id_240.js +++ b/sentinel-2/indexdb/id_240.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=240 // -let index = (B08 - B04) / Math.pow((B08 + B04), 0.5); -let min = -0.53; -let max = 0.532; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.53; // Values below this appear as white (underflow) +var maxColorValue = 0.532; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / Math.pow((sample.B08 + sample.B04), 0.5); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_242.js b/sentinel-2/indexdb/id_242.js index 266066f7..6e10410f 100644 --- a/sentinel-2/indexdb/id_242.js +++ b/sentinel-2/indexdb/id_242.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=242 // -let index = (B08 - B11) / (B08 + B11); -let min = -0.89; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B11) / (sample.B08 + sample.B11); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_243.js b/sentinel-2/indexdb/id_243.js index 52e8a780..cf9ed655 100644 --- a/sentinel-2/indexdb/id_243.js +++ b/sentinel-2/indexdb/id_243.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=243 // -let index = Math.log(B08 / B04); -let min = -2.828; -let max = 2.837; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -2.828; // Values below this appear as white (underflow) +var maxColorValue = 2.837; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.log(sample.B08 / sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_244.js b/sentinel-2/indexdb/id_244.js index 103f31b5..f2f5f42e 100644 --- a/sentinel-2/indexdb/id_244.js +++ b/sentinel-2/indexdb/id_244.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=244 // -let index = (((B04 - B03) / (B04 + B03)) + 0.5) / Math.abs(((B04 - B03) / (B04 + B03)) + 0.5) * Math.sqrt(Math.abs((((B04 - B03) / (B04 + B03))) + 0.5)); -let min = -0.625; -let max = 1.18; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.625; // Values below this appear as white (underflow) +var maxColorValue = 1.18; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (((sample.B04 - sample.B03) / (sample.B04 + sample.B03)) + 0.5) / Math.abs(((sample.B04 - sample.B03) / (sample.B04 + sample.B03)) + 0.5) * Math.sqrt(Math.abs((((sample.B04 - sample.B03) / (sample.B04 + sample.B03))) + 0.5)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_245.js b/sentinel-2/indexdb/id_245.js index 8c4fad8b..1cf6293c 100644 --- a/sentinel-2/indexdb/id_245.js +++ b/sentinel-2/indexdb/id_245.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=245 // -let index = (B08 - B12) / (B08 + B12); -let min = -0.889; -let max = 0.888; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.888; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B12) / (sample.B08 + sample.B12); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_247.js b/sentinel-2/indexdb/id_247.js index a7e846b4..76f26470 100644 --- a/sentinel-2/indexdb/id_247.js +++ b/sentinel-2/indexdb/id_247.js @@ -7,30 +7,75 @@ // // Initialize parameters -let a = 0.419; -let b = 0.787; - -let index = (a * B08 - a * B04 - b) / (B04 + a * B08 - a * b); -let min = -211.158; -let max = 200.042; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -211.158; // Values below this appear as white (underflow) +var maxColorValue = 200.042; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.419; + let b = 0.787; + + let index = (a * sample.B08 - a * sample.B04 - b) / (sample.B04 + a * sample.B08 - a * b); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_25.js b/sentinel-2/indexdb/id_25.js index 4892789f..cb6849a6 100644 --- a/sentinel-2/indexdb/id_25.js +++ b/sentinel-2/indexdb/id_25.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=25 // -let index = ((2.0 * (Math.pow(B08, 2.0) - Math.pow(B04, 2.0)) + 1.5 * B08 + 0.5 * B04) / (B08 + B04 + 0.5) * (1.0 - 0.25 * (2.0 * (Math.pow(B08, 2.0) - Math.pow(B04, 2.0)) + 1.5 * B08 + 0.5 * B04) / (B08 + B04 + 0.5)) - (B04 - 0.125) / (1.0 - B04)); -let min = -0.433; -let max = 0.808; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.433; // Values below this appear as white (underflow) +var maxColorValue = 0.808; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((2.0 * (Math.pow(sample.B08, 2.0) - Math.pow(sample.B04, 2.0)) + 1.5 * sample.B08 + 0.5 * sample.B04) / (sample.B08 + sample.B04 + 0.5) * (1.0 - 0.25 * (2.0 * (Math.pow(sample.B08, 2.0) - Math.pow(sample.B04, 2.0)) + 1.5 * sample.B08 + 0.5 * sample.B04) / (sample.B08 + sample.B04 + 0.5)) - (sample.B04 - 0.125) / (1.0 - sample.B04)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_250.js b/sentinel-2/indexdb/id_250.js index 0dfb1e19..c6925d72 100644 --- a/sentinel-2/indexdb/id_250.js +++ b/sentinel-2/indexdb/id_250.js @@ -7,25 +7,69 @@ // // Initialize parameters -let a = 0.496; - -let index = (Math.abs(((B05 - B03) / 150.0 * B04 + B04 + B03 - (a * B03))) / Math.pow((Math.pow(a, 2.0) + 1.0), 0.5)) * (B05 / B04); -let min = 0.019; -let max = 2.047; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.019; // Values below this appear as white (underflow) +var maxColorValue = 2.047; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.496; + + let index = (Math.abs(((sample.B05 - sample.B03) / 150.0 * sample.B04 + sample.B04 + sample.B03 - (a * sample.B03))) / Math.pow((Math.pow(a, 2.0) + 1.0), 0.5)) * (sample.B05 / sample.B04); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_251.js b/sentinel-2/indexdb/id_251.js index e7230d01..cb27eaae 100644 --- a/sentinel-2/indexdb/id_251.js +++ b/sentinel-2/indexdb/id_251.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=251 // -let index = Math.pow((B07 / B03), (-1.0)); -let min = 0.059; -let max = 17.114; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.114; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.pow((sample.B07 / sample.B03), (-1.0)); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_252.js b/sentinel-2/indexdb/id_252.js index c2dd64bc..600c65ae 100644 --- a/sentinel-2/indexdb/id_252.js +++ b/sentinel-2/indexdb/id_252.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=252 // -let index = Math.pow((B07 / B05), (-1.0)); -let min = 0.058; -let max = 16.732; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 16.732; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.pow((sample.B07 / sample.B05), (-1.0)); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_253.js b/sentinel-2/indexdb/id_253.js index 0718ff13..a434d264 100644 --- a/sentinel-2/indexdb/id_253.js +++ b/sentinel-2/indexdb/id_253.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=253 // -let index = Math.pow(B02, (-1.0)) - Math.pow(B03, (-1.0)); -let min = -65.066; -let max = 64.541; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -65.066; // Values below this appear as white (underflow) +var maxColorValue = 64.541; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.pow(sample.B02, (-1.0)) - Math.pow(sample.B03, (-1.0)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_254.js b/sentinel-2/indexdb/id_254.js index 330604a4..79e5394a 100644 --- a/sentinel-2/indexdb/id_254.js +++ b/sentinel-2/indexdb/id_254.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=254 // -let index = Math.pow(B02, (-1.0)) - Math.pow(B05, (-1.0)); -let min = -64.099; -let max = 64.37; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -64.099; // Values below this appear as white (underflow) +var maxColorValue = 64.37; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.pow(sample.B02, (-1.0)) - Math.pow(sample.B05, (-1.0)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_256.js b/sentinel-2/indexdb/id_256.js index b4e2d50b..713f02ca 100644 --- a/sentinel-2/indexdb/id_256.js +++ b/sentinel-2/indexdb/id_256.js @@ -7,26 +7,70 @@ // // Initialize parameters -let a = 0.331; -let b = 0.329; - -let index = a * B04 / Math.pow((B03 * B05), b); -let min = 0.014; -let max = 0.871; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.014; // Values below this appear as white (underflow) +var maxColorValue = 0.871; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.331; + let b = 0.329; + + let index = a * sample.B04 / Math.pow((sample.B03 * sample.B05), b); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_257.js b/sentinel-2/indexdb/id_257.js index 4da77ee5..72821ffb 100644 --- a/sentinel-2/indexdb/id_257.js +++ b/sentinel-2/indexdb/id_257.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=257 // -let index = (Math.pow(B02, (-1.0)) - Math.pow(B03, (-1.0))) * B08; -let min = -14.929; -let max = 14.894; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -14.929; // Values below this appear as white (underflow) +var maxColorValue = 14.894; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (Math.pow(sample.B02, (-1.0)) - Math.pow(sample.B03, (-1.0))) * sample.B08; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_258.js b/sentinel-2/indexdb/id_258.js index 179b4fad..85d820aa 100644 --- a/sentinel-2/indexdb/id_258.js +++ b/sentinel-2/indexdb/id_258.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=258 // -let index = (Math.pow(B02, (-1.0)) - Math.pow(B05, (-1.0))) * B08; -let min = -14.847; -let max = 14.965; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -14.847; // Values below this appear as white (underflow) +var maxColorValue = 14.965; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (Math.pow(sample.B02, (-1.0)) - Math.pow(sample.B05, (-1.0))) * sample.B08; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_259.js b/sentinel-2/indexdb/id_259.js index 9bd63cca..8ec7cd0d 100644 --- a/sentinel-2/indexdb/id_259.js +++ b/sentinel-2/indexdb/id_259.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=259 // -let index = (B08 - B04) / (B08 + B04 - 2.0 * B01); -let min = -16.803; -let max = 16.613; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -16.803; // Values below this appear as white (underflow) +var maxColorValue = 16.613; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04 - 2.0 * sample.B01); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_26.js b/sentinel-2/indexdb/id_26.js index d2ed9776..0d7f9d73 100644 --- a/sentinel-2/indexdb/id_26.js +++ b/sentinel-2/indexdb/id_26.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=26 // -let index = B11 / B04; -let min = 0.059; -let max = 17.361; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.361; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_260.js b/sentinel-2/indexdb/id_260.js index 2167aa8e..01a453d9 100644 --- a/sentinel-2/indexdb/id_260.js +++ b/sentinel-2/indexdb/id_260.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=260 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.888; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.888; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_27.js b/sentinel-2/indexdb/id_27.js index 1635edbc..0712d29e 100644 --- a/sentinel-2/indexdb/id_27.js +++ b/sentinel-2/indexdb/id_27.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=27 // -let index = B08 - B03; -let min = -0.335; -let max = 0.335; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.335; // Values below this appear as white (underflow) +var maxColorValue = 0.335; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 - sample.B03; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_271.js b/sentinel-2/indexdb/id_271.js index ad87988a..684d1b35 100644 --- a/sentinel-2/indexdb/id_271.js +++ b/sentinel-2/indexdb/id_271.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=271 // -let index = B03 / B04; -let min = 0.058; -let max = 17.183; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.183; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_276.js b/sentinel-2/indexdb/id_276.js index 0b8edee0..91754820 100644 --- a/sentinel-2/indexdb/id_276.js +++ b/sentinel-2/indexdb/id_276.js @@ -7,26 +7,70 @@ // // Initialize parameters -let a = 0.393; -let b = 0.809; - -let index = (B08 - b) / (a * B04); -let min = -109.359; -let max = -2.985; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -109.359; // Values below this appear as white (underflow) +var maxColorValue = -2.985; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.393; + let b = 0.809; + + let index = (sample.B08 - b) / (a * sample.B04); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_278.js b/sentinel-2/indexdb/id_278.js index c1a6d4a0..20950239 100644 --- a/sentinel-2/indexdb/id_278.js +++ b/sentinel-2/indexdb/id_278.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=278 // -let index = (B07 - B04) / (B07 + B04); -let min = -0.89; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B07 - sample.B04) / (sample.B07 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_28.js b/sentinel-2/indexdb/id_28.js index 254c9e47..fdae4e6a 100644 --- a/sentinel-2/indexdb/id_28.js +++ b/sentinel-2/indexdb/id_28.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=28 // -let index = (B08 - B03) / (B08 + B03); -let min = -0.889; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B03) / (sample.B08 + sample.B03); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_282.js b/sentinel-2/indexdb/id_282.js index 721fec35..cf0b5abd 100644 --- a/sentinel-2/indexdb/id_282.js +++ b/sentinel-2/indexdb/id_282.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=282 // -let index = B08 / B04; -let min = 0.058; -let max = 17.139; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.139; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_283.js b/sentinel-2/indexdb/id_283.js index 4462d862..77936a70 100644 --- a/sentinel-2/indexdb/id_283.js +++ b/sentinel-2/indexdb/id_283.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=283 // -let index = B08 / B04; -let min = 0.06; -let max = 16.668; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.06; // Values below this appear as white (underflow) +var maxColorValue = 16.668; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_284.js b/sentinel-2/indexdb/id_284.js index 49d7752e..ca6aff94 100644 --- a/sentinel-2/indexdb/id_284.js +++ b/sentinel-2/indexdb/id_284.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=284 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.887; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.887; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_285.js b/sentinel-2/indexdb/id_285.js index 8982e999..f01d7e25 100644 --- a/sentinel-2/indexdb/id_285.js +++ b/sentinel-2/indexdb/id_285.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=285 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.891; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.891; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_286.js b/sentinel-2/indexdb/id_286.js index c1fbffc6..44127ab6 100644 --- a/sentinel-2/indexdb/id_286.js +++ b/sentinel-2/indexdb/id_286.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=286 // -let index = (B08 - B02) / (B08 + B02); -let min = -0.889; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B02) / (sample.B08 + sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_287.js b/sentinel-2/indexdb/id_287.js index e6b7a8fd..5a9b3adc 100644 --- a/sentinel-2/indexdb/id_287.js +++ b/sentinel-2/indexdb/id_287.js @@ -7,26 +7,70 @@ // // Initialize parameters -let r700 = 0.715; -let r675 = 0.722; - -let index = (B04 / B05) / (r675 / r700); -let min = 0.058; -let max = 16.866; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 16.866; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let r700 = 0.715; + let r675 = 0.722; + + let index = (sample.B04 / sample.B05) / (r675 / r700); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_29.js b/sentinel-2/indexdb/id_29.js index 8f28ad5c..85c465e9 100644 --- a/sentinel-2/indexdb/id_29.js +++ b/sentinel-2/indexdb/id_29.js @@ -7,29 +7,74 @@ // // Initialize parameters -let Y = 0.120; - -let index = (B08 - B03) / (B08 + B03 + Y); -let min = -0.657; -let max = 0.653; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.657; // Values below this appear as white (underflow) +var maxColorValue = 0.653; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let Y = 0.120; + + let index = (sample.B08 - sample.B03) / (sample.B08 + sample.B03 + Y); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_291.js b/sentinel-2/indexdb/id_291.js index 64fae13e..62229f90 100644 --- a/sentinel-2/indexdb/id_291.js +++ b/sentinel-2/indexdb/id_291.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=291 // -let index = (B08 - B02) / (B08 - B04); -let min = -31.864; -let max = 33.576; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -31.864; // Values below this appear as white (underflow) +var maxColorValue = 33.576; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B02) / (sample.B08 - sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_293.js b/sentinel-2/indexdb/id_293.js index 29f60e8c..37f75a0f 100644 --- a/sentinel-2/indexdb/id_293.js +++ b/sentinel-2/indexdb/id_293.js @@ -7,26 +7,70 @@ // // Initialize parameters -let r500 = 0.535; -let r800 = 0.712; - -let index = (B08 / B02) / (r800 / r500); -let min = 0.044; -let max = 12.54; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.044; // Values below this appear as white (underflow) +var maxColorValue = 12.54; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let r500 = 0.535; + let r800 = 0.712; + + let index = (sample.B08 / sample.B02) / (r800 / r500); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_294.js b/sentinel-2/indexdb/id_294.js index dd06e0fe..74a874f1 100644 --- a/sentinel-2/indexdb/id_294.js +++ b/sentinel-2/indexdb/id_294.js @@ -7,26 +7,70 @@ // // Initialize parameters -let r470 = 0.503; -let r800 = 0.153; - -let index = (B08 / B02) / (r800 / r470); -let min = 0.191; -let max = 56.218; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.191; // Values below this appear as white (underflow) +var maxColorValue = 56.218; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let r470 = 0.503; + let r800 = 0.153; + + let index = (sample.B08 / sample.B02) / (r800 / r470); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_298.js b/sentinel-2/indexdb/id_298.js index 4eb1e436..30a645f8 100644 --- a/sentinel-2/indexdb/id_298.js +++ b/sentinel-2/indexdb/id_298.js @@ -7,26 +7,70 @@ // // Initialize parameters -let r700 = 0.989; -let r680 = 0.848; - -let index = (B04 / B05) / (r680 / r700); -let min = 0.069; -let max = 20.16; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.069; // Values below this appear as white (underflow) +var maxColorValue = 20.16; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let r700 = 0.989; + let r680 = 0.848; + + let index = (sample.B04 / sample.B05) / (r680 / r700); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_299.js b/sentinel-2/indexdb/id_299.js index bf12f1db..d2f14d5e 100644 --- a/sentinel-2/indexdb/id_299.js +++ b/sentinel-2/indexdb/id_299.js @@ -7,26 +7,70 @@ // // Initialize parameters -let r670 = 0.382; -let r800 = 0.935; - -let index = (B04 / B08) / (r670 / r800); -let min = 0.144; -let max = 41.524; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.144; // Values below this appear as white (underflow) +var maxColorValue = 41.524; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let r670 = 0.382; + let r800 = 0.935; + + let index = (sample.B04 / sample.B08) / (r670 / r800); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_30.js b/sentinel-2/indexdb/id_30.js index 3e227c38..b7e9d3ab 100644 --- a/sentinel-2/indexdb/id_30.js +++ b/sentinel-2/indexdb/id_30.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=30 // -let index = B08 / B03; -let min = 0.057; -let max = 17.379; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.379; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_300.js b/sentinel-2/indexdb/id_300.js index 5f1d7c1b..67da829e 100644 --- a/sentinel-2/indexdb/id_300.js +++ b/sentinel-2/indexdb/id_300.js @@ -7,26 +7,70 @@ // // Initialize parameters -let r680 = 0.523; -let r800 = 0.866; - -let index = (B04 / B08) / (r680 / r800); -let min = 0.097; -let max = 28.672; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.097; // Values below this appear as white (underflow) +var maxColorValue = 28.672; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let r680 = 0.523; + let r800 = 0.866; + + let index = (sample.B04 / sample.B08) / (r680 / r800); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_303.js b/sentinel-2/indexdb/id_303.js index e16f59be..a9ca37e0 100644 --- a/sentinel-2/indexdb/id_303.js +++ b/sentinel-2/indexdb/id_303.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=303 // -let index = B08 / B02; -let min = 0.057; -let max = 17.231; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.231; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B02; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_306.js b/sentinel-2/indexdb/id_306.js index 35910808..91f63781 100644 --- a/sentinel-2/indexdb/id_306.js +++ b/sentinel-2/indexdb/id_306.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=306 // -let index = (B08 - B02) / (B08 + B02); -let min = -0.89; -let max = 0.888; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.888; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B02) / (sample.B08 + sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_307.js b/sentinel-2/indexdb/id_307.js index 272cd55b..092419b7 100644 --- a/sentinel-2/indexdb/id_307.js +++ b/sentinel-2/indexdb/id_307.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=307 // -let index = B04; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_309.js b/sentinel-2/indexdb/id_309.js index 7327a4e4..83b5360f 100644 --- a/sentinel-2/indexdb/id_309.js +++ b/sentinel-2/indexdb/id_309.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=309 // -let index = B02; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B02; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_31.js b/sentinel-2/indexdb/id_31.js index 88f7ff0b..997e00b8 100644 --- a/sentinel-2/indexdb/id_31.js +++ b/sentinel-2/indexdb/id_31.js @@ -7,29 +7,74 @@ // // Initialize parameters -let L = 0.482; - -let index = (B08 - B03) / (B08 + B03 + L) * (1.0 + L); -let min = -0.563; -let max = 0.563; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.563; // Values below this appear as white (underflow) +var maxColorValue = 0.563; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let L = 0.482; + + let index = (sample.B08 - sample.B03) / (sample.B08 + sample.B03 + L) * (1.0 + L); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_310.js b/sentinel-2/indexdb/id_310.js index 9e6c1e58..e17e88dc 100644 --- a/sentinel-2/indexdb/id_310.js +++ b/sentinel-2/indexdb/id_310.js @@ -7,26 +7,70 @@ // // Initialize parameters -let a = 0.064; -let b = 0.918; - -let index = B08 / (B04 + b / a); -let min = 0.001; -let max = 0.027; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.001; // Values below this appear as white (underflow) +var maxColorValue = 0.027; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.064; + let b = 0.918; + + let index = sample.B08 / (sample.B04 + b / a); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_312.js b/sentinel-2/indexdb/id_312.js index 803f0eb1..68bae9f8 100644 --- a/sentinel-2/indexdb/id_312.js +++ b/sentinel-2/indexdb/id_312.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=312 // -let index = B05; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_316.js b/sentinel-2/indexdb/id_316.js index 105ad7ba..0c5c3f91 100644 --- a/sentinel-2/indexdb/id_316.js +++ b/sentinel-2/indexdb/id_316.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=316 // -let index = B03 / B04; -let min = 0.059; -let max = 17.529; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.529; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_317.js b/sentinel-2/indexdb/id_317.js index 6e12200c..dff9e487 100644 --- a/sentinel-2/indexdb/id_317.js +++ b/sentinel-2/indexdb/id_317.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=317 // -let index = B05 / B04; -let min = 0.058; -let max = 16.729; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 16.729; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B05 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_32.js b/sentinel-2/indexdb/id_32.js index f03230db..f54a3c32 100644 --- a/sentinel-2/indexdb/id_32.js +++ b/sentinel-2/indexdb/id_32.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=32 // -let index = B03 / B04; -let min = 0.059; -let max = 17.249; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.249; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_321.js b/sentinel-2/indexdb/id_321.js index 1b6f0aca..a480b804 100644 --- a/sentinel-2/indexdb/id_321.js +++ b/sentinel-2/indexdb/id_321.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=321 // -let index = B02 / B04; -let min = 0.058; -let max = 17.131; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.131; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B02 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_331.js b/sentinel-2/indexdb/id_331.js index 6a1ac153..2fcac3d1 100644 --- a/sentinel-2/indexdb/id_331.js +++ b/sentinel-2/indexdb/id_331.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=331 // -let index = (B04 + B07) / 2.0; -let min = 0.038; -let max = 0.372; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.038; // Values below this appear as white (underflow) +var maxColorValue = 0.372; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B04 + sample.B07) / 2.0; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_335.js b/sentinel-2/indexdb/id_335.js index 357e2edc..7e98a463 100644 --- a/sentinel-2/indexdb/id_335.js +++ b/sentinel-2/indexdb/id_335.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=335 // -let index = B05 / B04; -let min = 0.059; -let max = 17.548; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.548; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B05 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_336.js b/sentinel-2/indexdb/id_336.js index 472412ba..773cd3ce 100644 --- a/sentinel-2/indexdb/id_336.js +++ b/sentinel-2/indexdb/id_336.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=336 // -let index = (B05 - B04) / (B05 + B04); -let min = -0.892; -let max = 0.888; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.892; // Values below this appear as white (underflow) +var maxColorValue = 0.888; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B05 - sample.B04) / (sample.B05 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_337.js b/sentinel-2/indexdb/id_337.js index d9046dcb..c2c1acc7 100644 --- a/sentinel-2/indexdb/id_337.js +++ b/sentinel-2/indexdb/id_337.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=337 // -let index = B11 / B12; -let min = 0.057; -let max = 17.297; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.297; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_34.js b/sentinel-2/indexdb/id_34.js index d9561792..96c477bc 100644 --- a/sentinel-2/indexdb/id_34.js +++ b/sentinel-2/indexdb/id_34.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=34 // -let index = Math.atan((2.0 * B04 - B03 - B02) / 30.5 * (B03 - B02)); -let min = -0.003; -let max = 0.003; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.003; // Values below this appear as white (underflow) +var maxColorValue = 0.003; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.atan((2.0 * sample.B04 - sample.B03 - sample.B02) / 30.5 * (sample.B03 - sample.B02)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_340.js b/sentinel-2/indexdb/id_340.js index 5a908a18..a4dca654 100644 --- a/sentinel-2/indexdb/id_340.js +++ b/sentinel-2/indexdb/id_340.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=340 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_342.js b/sentinel-2/indexdb/id_342.js index d450008c..46c189dc 100644 --- a/sentinel-2/indexdb/id_342.js +++ b/sentinel-2/indexdb/id_342.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=342 // -let index = B04 / B05; -let min = 0.057; -let max = 17.25; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.25; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_343.js b/sentinel-2/indexdb/id_343.js index 6542e61d..83c258d8 100644 --- a/sentinel-2/indexdb/id_343.js +++ b/sentinel-2/indexdb/id_343.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=343 // -let index = B8A / B03; -let min = 0.058; -let max = 17.494; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B8A", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.494; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B8A / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_344.js b/sentinel-2/indexdb/id_344.js index 2ac1fc9b..c7c6278b 100644 --- a/sentinel-2/indexdb/id_344.js +++ b/sentinel-2/indexdb/id_344.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=344 // -let index = B8A / B05; -let min = 0.059; -let max = 17.32; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B8A", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.32; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B8A / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_345.js b/sentinel-2/indexdb/id_345.js index fcda9163..d6a4d286 100644 --- a/sentinel-2/indexdb/id_345.js +++ b/sentinel-2/indexdb/id_345.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=345 // -let index = B08 / B04; -let min = 0.059; -let max = 17.223; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.223; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_346.js b/sentinel-2/indexdb/id_346.js index 7fe4caea..bf3b8132 100644 --- a/sentinel-2/indexdb/id_346.js +++ b/sentinel-2/indexdb/id_346.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=346 // -let index = B08 / B03; -let min = 0.057; -let max = 17.048; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.048; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_347.js b/sentinel-2/indexdb/id_347.js index a5ec201e..a63998f8 100644 --- a/sentinel-2/indexdb/id_347.js +++ b/sentinel-2/indexdb/id_347.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=347 // -let index = B03; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_348.js b/sentinel-2/indexdb/id_348.js index 7f72e026..414ac766 100644 --- a/sentinel-2/indexdb/id_348.js +++ b/sentinel-2/indexdb/id_348.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=348 // -let index = B04; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_349.js b/sentinel-2/indexdb/id_349.js index 8f475543..07a3969e 100644 --- a/sentinel-2/indexdb/id_349.js +++ b/sentinel-2/indexdb/id_349.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=349 // -let index = B05; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_35.js b/sentinel-2/indexdb/id_35.js index 8942043e..55a33919 100644 --- a/sentinel-2/indexdb/id_35.js +++ b/sentinel-2/indexdb/id_35.js @@ -1,23 +1,66 @@ // Infrared percentage vegetation index // URL https://www.indexdatabase.de/db/si-single.php?rsindex_id=35=&sensor_id=96 -let index = ((B09) / (B09 + B05)) / (2) * (((B05 - B03) / (B05 + B03)) + 1); -let min = 0.028; -let max = 0.571; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -var underflow_color = [1, 1, 1]; -var low_color = [208 / 255, 88 / 255, 126 / 255]; -var high_color = [241 / 255, 234 / 255, 200 / 255]; -var overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], - [ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows - ]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B05", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.028; // Values below this appear as white (underflow) +var maxColorValue = 0.571; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((sample.B09) / (sample.B09 + sample.B05)) / (2) * (((sample.B05 - sample.B03) / (sample.B05 + sample.B03)) + 1); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + var underflow_color = [1, 1, 1]; + var low_color = [208 / 255, 88 / 255, 126 / 255]; + var high_color = [241 / 255, 234 / 255, 200 / 255]; + var overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_350.js b/sentinel-2/indexdb/id_350.js index e0608c33..203c69b2 100644 --- a/sentinel-2/indexdb/id_350.js +++ b/sentinel-2/indexdb/id_350.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=350 // -let index = B08; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_353.js b/sentinel-2/indexdb/id_353.js index 3b9c0e52..53e8a714 100644 --- a/sentinel-2/indexdb/id_353.js +++ b/sentinel-2/indexdb/id_353.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=353 // -let index = B09 - 2.4 * B04; -let min = -0.863; -let max = 0.291; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.863; // Values below this appear as white (underflow) +var maxColorValue = 0.291; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B09 - 2.4 * sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_355.js b/sentinel-2/indexdb/id_355.js index 49f77bb8..9d94f6a3 100644 --- a/sentinel-2/indexdb/id_355.js +++ b/sentinel-2/indexdb/id_355.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=355 // -let index = B04 / B03; -let min = 0.059; -let max = 17.013; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.013; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_356.js b/sentinel-2/indexdb/id_356.js index 62573b08..aac46795 100644 --- a/sentinel-2/indexdb/id_356.js +++ b/sentinel-2/indexdb/id_356.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=356 // -let index = (B03 - B04) / (B03 + B04 - B02); -let min = -15.455; -let max = 15.386; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -15.455; // Values below this appear as white (underflow) +var maxColorValue = 15.386; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B03 - sample.B04) / (sample.B03 + sample.B04 - sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_358.js b/sentinel-2/indexdb/id_358.js index 2d5bc41b..d2183635 100644 --- a/sentinel-2/indexdb/id_358.js +++ b/sentinel-2/indexdb/id_358.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=358 // -let index = (B05 - B04) / (B05 + B04); -let min = -0.891; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.891; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B05 - sample.B04) / (sample.B05 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_359.js b/sentinel-2/indexdb/id_359.js index 87463924..e490b102 100644 --- a/sentinel-2/indexdb/id_359.js +++ b/sentinel-2/indexdb/id_359.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=359 // -let index = (B05 - 1.7 * B04 + 0.7 * B02) / (B05 + 2.3 * B04 - 1.3 * B02); -let min = -13.584; -let max = 14.331; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -13.584; // Values below this appear as white (underflow) +var maxColorValue = 14.331; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B05 - 1.7 * sample.B04 + 0.7 * sample.B02) / (sample.B05 + 2.3 * sample.B04 - 1.3 * sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_36.js b/sentinel-2/indexdb/id_36.js index 72ea3665..319d6419 100644 --- a/sentinel-2/indexdb/id_36.js +++ b/sentinel-2/indexdb/id_36.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=36 // -let index = (1.0 / (30.5)) * (B04 + B03 + B02); -let min = 0.006; -let max = 0.034; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.006; // Values below this appear as white (underflow) +var maxColorValue = 0.034; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (1.0 / (30.5)) * (sample.B04 + sample.B03 + sample.B02); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_361.js b/sentinel-2/indexdb/id_361.js index 6617b36e..fdee1053 100644 --- a/sentinel-2/indexdb/id_361.js +++ b/sentinel-2/indexdb/id_361.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=361 // -let index = (B08 - B05) / (B08 + B05); -let min = -0.892; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.892; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B05) / (sample.B08 + sample.B05); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_362.js b/sentinel-2/indexdb/id_362.js index 8bfe7061..ab2b0bce 100644 --- a/sentinel-2/indexdb/id_362.js +++ b/sentinel-2/indexdb/id_362.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=362 // -let index = ((B08 / B04) - 1.0) / Math.sqrt((B08 / B04) + 1.0); -let min = -0.918; -let max = 3.768; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.918; // Values below this appear as white (underflow) +var maxColorValue = 3.768; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((sample.B08 / sample.B04) - 1.0) / Math.sqrt((sample.B08 / sample.B04) + 1.0); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_363.js b/sentinel-2/indexdb/id_363.js index 8be5e501..5da3d05b 100644 --- a/sentinel-2/indexdb/id_363.js +++ b/sentinel-2/indexdb/id_363.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=363 // -let index = (B08 - (B03 - (B02 - B04))) / (B08 - (B03 + (B02 - B04))); -let min = -33.268; -let max = 33.294; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -33.268; // Values below this appear as white (underflow) +var maxColorValue = 33.294; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - (sample.B03 - (sample.B02 - sample.B04))) / (sample.B08 - (sample.B03 + (sample.B02 - sample.B04))); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_366.js b/sentinel-2/indexdb/id_366.js index 5ed39a48..f8e44d2d 100644 --- a/sentinel-2/indexdb/id_366.js +++ b/sentinel-2/indexdb/id_366.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=366 // -let index = B08 / B05; -let min = 0.057; -let max = 16.993; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 16.993; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_367.js b/sentinel-2/indexdb/id_367.js index 05453246..8c751dec 100644 --- a/sentinel-2/indexdb/id_367.js +++ b/sentinel-2/indexdb/id_367.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=367 // -let index = Math.pow(B05, (-1.0)); -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.pow(sample.B05, (-1.0)); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_368.js b/sentinel-2/indexdb/id_368.js index 869f63f6..19c22bd0 100644 --- a/sentinel-2/indexdb/id_368.js +++ b/sentinel-2/indexdb/id_368.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=368 // -let index = Math.pow(B03, (-1.0)); -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.pow(sample.B03, (-1.0)); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_369.js b/sentinel-2/indexdb/id_369.js index 59738982..293f9e29 100644 --- a/sentinel-2/indexdb/id_369.js +++ b/sentinel-2/indexdb/id_369.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=369 // -let index = B04 / B05; -let min = 0.058; -let max = 17.118; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.118; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_370.js b/sentinel-2/indexdb/id_370.js index 99b19d13..fe8c5343 100644 --- a/sentinel-2/indexdb/id_370.js +++ b/sentinel-2/indexdb/id_370.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=370 // -let index = B04 / B03; -let min = 0.058; -let max = 17.388; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.388; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_372.js b/sentinel-2/indexdb/id_372.js index 7fce2f9e..6227a656 100644 --- a/sentinel-2/indexdb/id_372.js +++ b/sentinel-2/indexdb/id_372.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=372 // -let index = ((B08 + 0.1) - (B12 + 0.02)) / ((B08 + 0.1) + (B12 + 0.02)); -let min = -0.492; -let max = 0.826; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.492; // Values below this appear as white (underflow) +var maxColorValue = 0.826; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((sample.B08 + 0.1) - (sample.B12 + 0.02)) / ((sample.B08 + 0.1) + (sample.B12 + 0.02)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_375.js b/sentinel-2/indexdb/id_375.js index 02bd4f95..791b05a3 100644 --- a/sentinel-2/indexdb/id_375.js +++ b/sentinel-2/indexdb/id_375.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=375 // -let index = (2.0 * B03 - B04 - B02) / (2.0 * B03 + B04 + B02); -let min = -0.88; -let max = 0.735; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.88; // Values below this appear as white (underflow) +var maxColorValue = 0.735; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (2.0 * sample.B03 - sample.B04 - sample.B02) / (2.0 * sample.B03 + sample.B04 + sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_377.js b/sentinel-2/indexdb/id_377.js index 5e00db65..b938cdbc 100644 --- a/sentinel-2/indexdb/id_377.js +++ b/sentinel-2/indexdb/id_377.js @@ -7,31 +7,76 @@ // // Initialize parameters -let SWIRmin = 0.378; -let SWIRmax = 0.397; -let SWIIRmin = 0.027; - -let index = (B08 - B04) / (B08 + B04) * (1.0 - (B12 - SWIIRmin) / (SWIRmax - SWIRmin)); -let min = -12.595; -let max = 12.598; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -12.595; // Values below this appear as white (underflow) +var maxColorValue = 12.598; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let SWIRmin = 0.378; + let SWIRmax = 0.397; + let SWIIRmin = 0.027; + + let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04) * (1.0 - (sample.B12 - SWIIRmin) / (SWIRmax - SWIRmin)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_38.js b/sentinel-2/indexdb/id_38.js index 69ff47ca..bcb86708 100644 --- a/sentinel-2/indexdb/id_38.js +++ b/sentinel-2/indexdb/id_38.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=38 // -let index = B11 / B12; -let min = 0.057; -let max = 17.244; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.244; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_383.js b/sentinel-2/indexdb/id_383.js index 9d9203f3..416c50d4 100644 --- a/sentinel-2/indexdb/id_383.js +++ b/sentinel-2/indexdb/id_383.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=383 // -let index = B08; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_385.js b/sentinel-2/indexdb/id_385.js index 94c84571..a73e52c3 100644 --- a/sentinel-2/indexdb/id_385.js +++ b/sentinel-2/indexdb/id_385.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=385 // -let index = (B07 - B04) / (B07 + B04); -let min = -0.889; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B07 - sample.B04) / (sample.B07 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_387.js b/sentinel-2/indexdb/id_387.js index 6cb9b71a..da3f5e49 100644 --- a/sentinel-2/indexdb/id_387.js +++ b/sentinel-2/indexdb/id_387.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=387 // -let index = 2.5 * (B08 - B04) / (1.0 + B08 + 6.0 * B04 - 7.5 * B02); -let min = -8.09; -let max = 8.065; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -8.09; // Values below this appear as white (underflow) +var maxColorValue = 8.065; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 2.5 * (sample.B08 - sample.B04) / (1.0 + sample.B08 + 6.0 * sample.B04 - 7.5 * sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_390.js b/sentinel-2/indexdb/id_390.js index 693521f1..fcf82242 100644 --- a/sentinel-2/indexdb/id_390.js +++ b/sentinel-2/indexdb/id_390.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=390 // -let index = (B03 - B04) / (B03 + B04); -let min = -0.888; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.888; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B03 - sample.B04) / (sample.B03 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_391.js b/sentinel-2/indexdb/id_391.js index bbad78b7..f7e7f606 100644 --- a/sentinel-2/indexdb/id_391.js +++ b/sentinel-2/indexdb/id_391.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=391 // -let index = B08 * B04 / Math.pow(B03, 2.0); -let min = 0.016; -let max = 220.152; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.016; // Values below this appear as white (underflow) +var maxColorValue = 220.152; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 * sample.B04 / Math.pow(sample.B03, 2.0); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_392.js b/sentinel-2/indexdb/id_392.js index bd09fc30..e2965db3 100644 --- a/sentinel-2/indexdb/id_392.js +++ b/sentinel-2/indexdb/id_392.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=392 // -let index = 1.2 * (B05 - B03) - 1.5 * (B04 - B03) * Math.sqrt(B05 / B04); -let min = -0.353; -let max = 1.498; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.353; // Values below this appear as white (underflow) +var maxColorValue = 1.498; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.2 * (sample.B05 - sample.B03) - 1.5 * (sample.B04 - sample.B03) * Math.sqrt(sample.B05 / sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_393.js b/sentinel-2/indexdb/id_393.js index c9d29549..1ffa686d 100644 --- a/sentinel-2/indexdb/id_393.js +++ b/sentinel-2/indexdb/id_393.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=393 // -let index = B08 - 0.66 * B11 / (B08 + 0.66 * B11); -let min = -0.9; -let max = 0.312; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.9; // Values below this appear as white (underflow) +var maxColorValue = 0.312; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 - 0.66 * sample.B11 / (sample.B08 + 0.66 * sample.B11); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_394.js b/sentinel-2/indexdb/id_394.js index c81689b4..3bb13fbe 100644 --- a/sentinel-2/indexdb/id_394.js +++ b/sentinel-2/indexdb/id_394.js @@ -7,29 +7,74 @@ // // Initialize parameters -let L = 0.781; - -let index = (B08 - B12) * (1.0 + L) / (B08 + B12 + L); -let min = -0.505; -let max = 0.505; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.505; // Values below this appear as white (underflow) +var maxColorValue = 0.505; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let L = 0.781; + + let index = (sample.B08 - sample.B12) * (1.0 + L) / (sample.B08 + sample.B12 + L); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_395.js b/sentinel-2/indexdb/id_395.js index c9dacaa8..232b4484 100644 --- a/sentinel-2/indexdb/id_395.js +++ b/sentinel-2/indexdb/id_395.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=395 // -let index = B08 - 0.5 * B12 / (B08 + 0.56 * B12); -let min = -0.79; -let max = 0.327; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.79; // Values below this appear as white (underflow) +var maxColorValue = 0.327; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 - 0.5 * sample.B12 / (sample.B08 + 0.56 * sample.B12); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_396.js b/sentinel-2/indexdb/id_396.js index 1f2eb82a..a963cbeb 100644 --- a/sentinel-2/indexdb/id_396.js +++ b/sentinel-2/indexdb/id_396.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=396 // -let index = -0.18 + 1.17 * ((B08 - B04) / (B08 + B04)); -let min = -1.221; -let max = 0.862; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -1.221; // Values below this appear as white (underflow) +var maxColorValue = 0.862; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = -0.18 + 1.17 * ((sample.B08 - sample.B04) / (sample.B08 + sample.B04)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_397.js b/sentinel-2/indexdb/id_397.js index 12d7e534..1a7ff2a1 100644 --- a/sentinel-2/indexdb/id_397.js +++ b/sentinel-2/indexdb/id_397.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=397 // -let index = B03 / B08; -let min = 0.058; -let max = 17.495; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.495; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03 / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_398.js b/sentinel-2/indexdb/id_398.js index a4c05644..dae3ebbd 100644 --- a/sentinel-2/indexdb/id_398.js +++ b/sentinel-2/indexdb/id_398.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=398 // -let index = B08 - B03; -let min = -0.335; -let max = 0.333; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.335; // Values below this appear as white (underflow) +var maxColorValue = 0.333; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 - sample.B03; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_4.js b/sentinel-2/indexdb/id_4.js index 49a07b02..ad7f86c1 100644 --- a/sentinel-2/indexdb/id_4.js +++ b/sentinel-2/indexdb/id_4.js @@ -1,4 +1,4 @@ -// VERSION=3 +//VERSION=3 // Atmospherically Resistant Vegetation Index (abbrv. ARVI) // // General formula: (NIR - RED - y * (RED - BLUE))/ (NIR + RED - y*(RED-BLUE)) @@ -7,29 +7,74 @@ // // Initialize parameters -let y = 0.069; - -let index = (B8A - B04 - y * (B04 - B02)) / (B8A + B04 - y * (B04 - B02)); -let min = -0.942; -let max = 0.895; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -var underflow_color = [1,1,1]; -var low_color = [208/255, 88/255, 126/255]; -var high_color = [241/255, 234/255, 200/255]; -var zero_color = [0, 147/255, 146/255]; -var overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "B8A", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.942; // Values below this appear as white (underflow) +var maxColorValue = 0.895; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let y = 0.069; + + let index = (sample.B8A - sample.B04 - y * (sample.B04 - sample.B02)) / (sample.B8A + sample.B04 - y * (sample.B04 - sample.B02)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + var underflow_color = [1,1,1]; + var low_color = [208/255, 88/255, 126/255]; + var high_color = [241/255, 234/255, 200/255]; + var zero_color = [0, 147/255, 146/255]; + var overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_400.js b/sentinel-2/indexdb/id_400.js index 23a0de10..cc2e4284 100644 --- a/sentinel-2/indexdb/id_400.js +++ b/sentinel-2/indexdb/id_400.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=400 // -let index = (B07 - B03) / (B07 + B03); -let min = -0.888; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.888; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B07 - sample.B03) / (sample.B07 + sample.B03); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_401.js b/sentinel-2/indexdb/id_401.js index 0f0d3ad9..31cd79d6 100644 --- a/sentinel-2/indexdb/id_401.js +++ b/sentinel-2/indexdb/id_401.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=401 // -let index = (B08 - B03) / (B08 + B03); -let min = -0.89; -let max = 0.888; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.888; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B03) / (sample.B08 + sample.B03); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_402.js b/sentinel-2/indexdb/id_402.js index 63be8129..85753678 100644 --- a/sentinel-2/indexdb/id_402.js +++ b/sentinel-2/indexdb/id_402.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=402 // -let index = 1.0 / B05; -let min = 2.523; -let max = 70.698; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 2.523; // Values below this appear as white (underflow) +var maxColorValue = 70.698; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.0 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_403.js b/sentinel-2/indexdb/id_403.js index c0ff0f66..ede01202 100644 --- a/sentinel-2/indexdb/id_403.js +++ b/sentinel-2/indexdb/id_403.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=403 // -let index = B08 - B04; -let min = -0.335; -let max = 0.336; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.335; // Values below this appear as white (underflow) +var maxColorValue = 0.336; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 - sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_409.js b/sentinel-2/indexdb/id_409.js index 2d7bc9e9..7b73d807 100644 --- a/sentinel-2/indexdb/id_409.js +++ b/sentinel-2/indexdb/id_409.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=409 // -let index = B06 / B05; -let min = 0.059; -let max = 17.229; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B05", "B06", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.229; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B06 / sample.B05; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_41.js b/sentinel-2/indexdb/id_41.js index 198a0836..37a14773 100644 --- a/sentinel-2/indexdb/id_41.js +++ b/sentinel-2/indexdb/id_41.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=41 // -let index = ((B05 - B04) - 0.2 * (B05 - B03)) * (B05 / B04); -let min = -0.103; -let max = 4.677; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.103; // Values below this appear as white (underflow) +var maxColorValue = 4.677; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = ((sample.B05 - sample.B04) - 0.2 * (sample.B05 - sample.B03)) * (sample.B05 / sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_415.js b/sentinel-2/indexdb/id_415.js index e1d97b6d..6372cbd3 100644 --- a/sentinel-2/indexdb/id_415.js +++ b/sentinel-2/indexdb/id_415.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=415 // -let index = B01 / B06; -let min = 0.059; -let max = 17.003; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B06", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.003; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B01 / sample.B06; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_419.js b/sentinel-2/indexdb/id_419.js index d403da52..8ff6a196 100644 --- a/sentinel-2/indexdb/id_419.js +++ b/sentinel-2/indexdb/id_419.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=419 // -let index = (B08 - B03) / (B08 + B03); -let min = -0.89; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B03) / (sample.B08 + sample.B03); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_42.js b/sentinel-2/indexdb/id_42.js index b39cd3f1..37385ec3 100644 --- a/sentinel-2/indexdb/id_42.js +++ b/sentinel-2/indexdb/id_42.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=42 // -let index = 1.2 * (2.5 * (B08 - B04) - 1.3 * (B08 - B03)); -let min = -0.88; -let max = 0.879; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.88; // Values below this appear as white (underflow) +var maxColorValue = 0.879; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.2 * (2.5 * (sample.B08 - sample.B04) - 1.3 * (sample.B08 - sample.B03)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_427.js b/sentinel-2/indexdb/id_427.js index 688caa5d..fa9ad697 100644 --- a/sentinel-2/indexdb/id_427.js +++ b/sentinel-2/indexdb/id_427.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=427 // -let index = B08 / B12; -let min = 0.058; -let max = 17.059; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.059; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_43.js b/sentinel-2/indexdb/id_43.js index bdc68220..85fac590 100644 --- a/sentinel-2/indexdb/id_43.js +++ b/sentinel-2/indexdb/id_43.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=43 // -let index = 1.5 * (2.5 * (B08 - B04) - 1.3 * (B08 - B03)) / Math.sqrt(Math.pow((2.0 * B08 + 1.0), 2.0) - (6.0 * B08 - 5.0 * Math.sqrt(B04)) - 0.5); -let min = -0.598; -let max = 1.032; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.598; // Values below this appear as white (underflow) +var maxColorValue = 1.032; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.5 * (2.5 * (sample.B08 - sample.B04) - 1.3 * (sample.B08 - sample.B03)) / Math.sqrt(Math.pow((2.0 * sample.B08 + 1.0), 2.0) - (6.0 * sample.B08 - 5.0 * Math.sqrt(sample.B04)) - 0.5); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_44.js b/sentinel-2/indexdb/id_44.js index e3c2bd28..08a44995 100644 --- a/sentinel-2/indexdb/id_44.js +++ b/sentinel-2/indexdb/id_44.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=44 // -let index = (2.0 * B08 + 1.0 - Math.sqrt(Math.pow((2.0 * B08 + 1.0), 2.0) - 8.0 * (B08 - B04))) / 2.0; -let min = -0.443; -let max = 0.579; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.443; // Values below this appear as white (underflow) +var maxColorValue = 0.579; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (2.0 * sample.B08 + 1.0 - Math.sqrt(Math.pow((2.0 * sample.B08 + 1.0), 2.0) - 8.0 * (sample.B08 - sample.B04))) / 2.0; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_45.js b/sentinel-2/indexdb/id_45.js index 2e03c355..311cf557 100644 --- a/sentinel-2/indexdb/id_45.js +++ b/sentinel-2/indexdb/id_45.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=45 // -let index = (0.5) * ((2.0 * B08 + 1.0) - Math.sqrt(Math.pow((2.0 * B08 + 1.0), 2.0) - 8.0 * (B08 - B04))); -let min = -0.44; -let max = 0.58; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.44; // Values below this appear as white (underflow) +var maxColorValue = 0.58; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (0.5) * ((2.0 * sample.B08 + 1.0) - Math.sqrt(Math.pow((2.0 * sample.B08 + 1.0), 2.0) - 8.0 * (sample.B08 - sample.B04))); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_46.js b/sentinel-2/indexdb/id_46.js index 53d4df64..150a93f0 100644 --- a/sentinel-2/indexdb/id_46.js +++ b/sentinel-2/indexdb/id_46.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=46 // -let index = 1.2 * (1.2 * (B08 - B03) - 2.5 * (B04 - B03)); -let min = -0.88; -let max = 0.882; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.88; // Values below this appear as white (underflow) +var maxColorValue = 0.882; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.2 * (1.2 * (sample.B08 - sample.B03) - 2.5 * (sample.B04 - sample.B03)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_462.js b/sentinel-2/indexdb/id_462.js index 5e9bec0c..015b0669 100644 --- a/sentinel-2/indexdb/id_462.js +++ b/sentinel-2/indexdb/id_462.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=462 // -let index = (B08 - B12) / (B08 + B12); -let min = -0.89; -let max = 0.892; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.892; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B12) / (sample.B08 + sample.B12); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_47.js b/sentinel-2/indexdb/id_47.js index 7af09772..707cff66 100644 --- a/sentinel-2/indexdb/id_47.js +++ b/sentinel-2/indexdb/id_47.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=47 // -let index = 1.5 * (1.2 * (B08 - B03) - 2.5 * (B04 - B03)) / Math.sqrt(Math.pow((2.0 * B08 + 1.0), 2.0) - (6.0 * B08 - 5.0 * Math.sqrt(B04)) - 0.5); -let min = -0.597; -let max = 1.035; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.597; // Values below this appear as white (underflow) +var maxColorValue = 1.035; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 1.5 * (1.2 * (sample.B08 - sample.B03) - 2.5 * (sample.B04 - sample.B03)) / Math.sqrt(Math.pow((2.0 * sample.B08 + 1.0), 2.0) - (6.0 * sample.B08 - 5.0 * Math.sqrt(sample.B04)) - 0.5); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_479.js b/sentinel-2/indexdb/id_479.js index 52e270b2..70301a13 100644 --- a/sentinel-2/indexdb/id_479.js +++ b/sentinel-2/indexdb/id_479.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=479 // -let index = B08 / B12; -let min = 0.059; -let max = 17.59; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.59; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_48.js b/sentinel-2/indexdb/id_48.js index 2e07cfd8..0f173ccf 100644 --- a/sentinel-2/indexdb/id_48.js +++ b/sentinel-2/indexdb/id_48.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=48 // -let index = B11 / B08; -let min = 0.059; -let max = 17.357; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.357; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_480.js b/sentinel-2/indexdb/id_480.js index 6c65d214..c8da3a9b 100644 --- a/sentinel-2/indexdb/id_480.js +++ b/sentinel-2/indexdb/id_480.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=480 // -let index = (1.0 / B03 - 1.0 / B05) / B08; -let min = -723.725; -let max = 720.008; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B05", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -723.725; // Values below this appear as white (underflow) +var maxColorValue = 720.008; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (1.0 / sample.B03 - 1.0 / sample.B05) / sample.B08; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_481.js b/sentinel-2/indexdb/id_481.js index 4fb5073c..0101ab6f 100644 --- a/sentinel-2/indexdb/id_481.js +++ b/sentinel-2/indexdb/id_481.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=481 // -let index = B04 - B02; -let min = -0.335; -let max = 0.335; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.335; // Values below this appear as white (underflow) +var maxColorValue = 0.335; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 - sample.B02; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_483.js b/sentinel-2/indexdb/id_483.js index 0f30d1ca..8d54fb71 100644 --- a/sentinel-2/indexdb/id_483.js +++ b/sentinel-2/indexdb/id_483.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=483 // -let index = (B03 - B01) / (B03 + B01); -let min = -0.889; -let max = 0.892; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B03", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.892; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B03 - sample.B01) / (sample.B03 + sample.B01); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_484.js b/sentinel-2/indexdb/id_484.js index e1a90428..c0a51490 100644 --- a/sentinel-2/indexdb/id_484.js +++ b/sentinel-2/indexdb/id_484.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=484 // -let index = (B03 - B04) / (B03 + B04); -let min = -0.89; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B03 - sample.B04) / (sample.B03 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_488.js b/sentinel-2/indexdb/id_488.js index 48262827..9dbc5535 100644 --- a/sentinel-2/indexdb/id_488.js +++ b/sentinel-2/indexdb/id_488.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=488 // -let index = B02; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B02; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_490.js b/sentinel-2/indexdb/id_490.js index f3b29f42..635102ce 100644 --- a/sentinel-2/indexdb/id_490.js +++ b/sentinel-2/indexdb/id_490.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=490 // -let index = B04; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_50.js b/sentinel-2/indexdb/id_50.js index a6827e2f..5516dea7 100644 --- a/sentinel-2/indexdb/id_50.js +++ b/sentinel-2/indexdb/id_50.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=50 // -let index = B03 / (B08 + B04 + B03); -let min = 0.031; -let max = 0.765; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.031; // Values below this appear as white (underflow) +var maxColorValue = 0.765; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03 / (sample.B08 + sample.B04 + sample.B03); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_505.js b/sentinel-2/indexdb/id_505.js index 1fb6904a..c9ef7f1a 100644 --- a/sentinel-2/indexdb/id_505.js +++ b/sentinel-2/indexdb/id_505.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=505 // -let index = B11; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B11SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_51.js b/sentinel-2/indexdb/id_51.js index 3e047092..d493399d 100644 --- a/sentinel-2/indexdb/id_51.js +++ b/sentinel-2/indexdb/id_51.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=51 // -let index = B08 / (B08 + B04 + B03); -let min = 0.031; -let max = 0.765; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.031; // Values below this appear as white (underflow) +var maxColorValue = 0.765; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / (sample.B08 + sample.B04 + sample.B03); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_516.js b/sentinel-2/indexdb/id_516.js index df6612c7..53a1f4e6 100644 --- a/sentinel-2/indexdb/id_516.js +++ b/sentinel-2/indexdb/id_516.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=516 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_517.js b/sentinel-2/indexdb/id_517.js index 5bb2f824..50fcf1f6 100644 --- a/sentinel-2/indexdb/id_517.js +++ b/sentinel-2/indexdb/id_517.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=517 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_518.js b/sentinel-2/indexdb/id_518.js index d83dfeb2..545d923e 100644 --- a/sentinel-2/indexdb/id_518.js +++ b/sentinel-2/indexdb/id_518.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=518 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_519.js b/sentinel-2/indexdb/id_519.js index c82ae6d5..c8b546ea 100644 --- a/sentinel-2/indexdb/id_519.js +++ b/sentinel-2/indexdb/id_519.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=519 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_52.js b/sentinel-2/indexdb/id_52.js index 3d07018b..2ef76aeb 100644 --- a/sentinel-2/indexdb/id_52.js +++ b/sentinel-2/indexdb/id_52.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=52 // -let index = B04 / (B08 + B04 + B03); -let min = 0.031; -let max = 0.765; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.031; // Values below this appear as white (underflow) +var maxColorValue = 0.765; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / (sample.B08 + sample.B04 + sample.B03); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_520.js b/sentinel-2/indexdb/id_520.js index 57b44e62..569f4bb2 100644 --- a/sentinel-2/indexdb/id_520.js +++ b/sentinel-2/indexdb/id_520.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=520 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_521.js b/sentinel-2/indexdb/id_521.js index a0906c19..6b2e60ba 100644 --- a/sentinel-2/indexdb/id_521.js +++ b/sentinel-2/indexdb/id_521.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=521 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_522.js b/sentinel-2/indexdb/id_522.js index ad69af87..29b3fe6e 100644 --- a/sentinel-2/indexdb/id_522.js +++ b/sentinel-2/indexdb/id_522.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=522 // -let index = B12; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B12SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_528.js b/sentinel-2/indexdb/id_528.js index 3617768c..ee95b175 100644 --- a/sentinel-2/indexdb/id_528.js +++ b/sentinel-2/indexdb/id_528.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=528 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.891; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.891; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_53.js b/sentinel-2/indexdb/id_53.js index b9c2ed11..ca7b9d23 100644 --- a/sentinel-2/indexdb/id_53.js +++ b/sentinel-2/indexdb/id_53.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=53 // -let index = (B08 - B12) / (B08 + B12); -let min = -0.89; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B12) / (sample.B08 + sample.B12); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_533.js b/sentinel-2/indexdb/id_533.js index 5c0f05b7..1a578847 100644 --- a/sentinel-2/indexdb/id_533.js +++ b/sentinel-2/indexdb/id_533.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=533 // -let index = B02; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B02; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_534.js b/sentinel-2/indexdb/id_534.js index 749f66d1..12f736be 100644 --- a/sentinel-2/indexdb/id_534.js +++ b/sentinel-2/indexdb/id_534.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=534 // -let index = B03; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_535.js b/sentinel-2/indexdb/id_535.js index 53a91369..221b7478 100644 --- a/sentinel-2/indexdb/id_535.js +++ b/sentinel-2/indexdb/id_535.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=535 // -let index = B04; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_536.js b/sentinel-2/indexdb/id_536.js index 550ab087..080fd0ed 100644 --- a/sentinel-2/indexdb/id_536.js +++ b/sentinel-2/indexdb/id_536.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=536 // -let index = B04; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_537.js b/sentinel-2/indexdb/id_537.js index 1e1e9448..09687e47 100644 --- a/sentinel-2/indexdb/id_537.js +++ b/sentinel-2/indexdb/id_537.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=537 // -let index = B06; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B06SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B06; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_538.js b/sentinel-2/indexdb/id_538.js index e34b0328..1279cae4 100644 --- a/sentinel-2/indexdb/id_538.js +++ b/sentinel-2/indexdb/id_538.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=538 // -let index = B08; -let min = 0.013900000000000001; -let max = 0.7861; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.013900000000000001; // Values below this appear as white (underflow) +var maxColorValue = 0.7861; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_541.js b/sentinel-2/indexdb/id_541.js index 35decbd5..6a9162a9 100644 --- a/sentinel-2/indexdb/id_541.js +++ b/sentinel-2/indexdb/id_541.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=541 // -let index = B09 / B11; -let min = 0.057; -let max = 17.289; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B09", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.057; // Values below this appear as white (underflow) +var maxColorValue = 17.289; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B09 / sample.B11; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_544.js b/sentinel-2/indexdb/id_544.js index 48f7aca5..ce29f835 100644 --- a/sentinel-2/indexdb/id_544.js +++ b/sentinel-2/indexdb/id_544.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=544 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.889; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_547.js b/sentinel-2/indexdb/id_547.js index ce4cd8ed..dc53e8b5 100644 --- a/sentinel-2/indexdb/id_547.js +++ b/sentinel-2/indexdb/id_547.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=547 // -let index = B11 / B08; -let min = 0.058; -let max = 17.467; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.467; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B11 / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_548.js b/sentinel-2/indexdb/id_548.js index b8aa82a2..4270f6cc 100644 --- a/sentinel-2/indexdb/id_548.js +++ b/sentinel-2/indexdb/id_548.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=548 // -let index = (B08 - B11) / (B08 + B11); -let min = -0.89; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B11) / (sample.B08 + sample.B11); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_549.js b/sentinel-2/indexdb/id_549.js index 846a8cea..1dcbee8d 100644 --- a/sentinel-2/indexdb/id_549.js +++ b/sentinel-2/indexdb/id_549.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=549 // -let index = B08 / B04; -let min = 0.058; -let max = 16.85; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 16.85; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_550.js b/sentinel-2/indexdb/id_550.js index 7ba2c58c..d0d1fbff 100644 --- a/sentinel-2/indexdb/id_550.js +++ b/sentinel-2/indexdb/id_550.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=550 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.89; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_551.js b/sentinel-2/indexdb/id_551.js index 839d75a7..53bcd5e0 100644 --- a/sentinel-2/indexdb/id_551.js +++ b/sentinel-2/indexdb/id_551.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=551 // -let index = B08 - B04; -let min = -0.334; -let max = 0.336; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.334; // Values below this appear as white (underflow) +var maxColorValue = 0.336; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 - sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_552.js b/sentinel-2/indexdb/id_552.js index 67ff25a9..f65ac774 100644 --- a/sentinel-2/indexdb/id_552.js +++ b/sentinel-2/indexdb/id_552.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=552 // -let index = B03 / B04; -let min = 0.06; -let max = 17.007; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.06; // Values below this appear as white (underflow) +var maxColorValue = 17.007; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B03 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_553.js b/sentinel-2/indexdb/id_553.js index a8381025..78c07881 100644 --- a/sentinel-2/indexdb/id_553.js +++ b/sentinel-2/indexdb/id_553.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=553 // -let index = B08 / B11; -let min = 0.058; -let max = 17.336; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.336; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B11; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_554.js b/sentinel-2/indexdb/id_554.js index c7b6f83a..1e3e722c 100644 --- a/sentinel-2/indexdb/id_554.js +++ b/sentinel-2/indexdb/id_554.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=554 // -let index = (B08 - B11) / (B08 + B11); -let min = -0.891; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.891; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B11) / (sample.B08 + sample.B11); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_555.js b/sentinel-2/indexdb/id_555.js index 19b6e0ad..f96ea2a0 100644 --- a/sentinel-2/indexdb/id_555.js +++ b/sentinel-2/indexdb/id_555.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=555 // -let index = (1.0 + 0.5) * (B08 - B04) / (B08 + B04 + 0.5); -let min = -0.56; -let max = 0.558; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.56; // Values below this appear as white (underflow) +var maxColorValue = 0.558; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (1.0 + 0.5) * (sample.B08 - sample.B04) / (sample.B08 + sample.B04 + 0.5); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_556.js b/sentinel-2/indexdb/id_556.js index 0c8b7795..ea8b317d 100644 --- a/sentinel-2/indexdb/id_556.js +++ b/sentinel-2/indexdb/id_556.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=556 // -let index = (B08 - B04) / Math.sqrt(B08 + B04); -let min = -0.532; -let max = 0.531; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.532; // Values below this appear as white (underflow) +var maxColorValue = 0.531; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / Math.sqrt(sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_56.js b/sentinel-2/indexdb/id_56.js index 18dcf2f8..47b250b5 100644 --- a/sentinel-2/indexdb/id_56.js +++ b/sentinel-2/indexdb/id_56.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=56 // -let index = (B08 - B11) / (B08 + B11); -let min = -0.89; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.89; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B11) / (sample.B08 + sample.B11); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_562.js b/sentinel-2/indexdb/id_562.js index a7a44c5f..19bf0294 100644 --- a/sentinel-2/indexdb/id_562.js +++ b/sentinel-2/indexdb/id_562.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=562 // -let index = B07 / B04; -let min = 0.058; -let max = 17.039; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.058; // Values below this appear as white (underflow) +var maxColorValue = 17.039; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B07 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_563.js b/sentinel-2/indexdb/id_563.js index c0078ea5..39e2750f 100644 --- a/sentinel-2/indexdb/id_563.js +++ b/sentinel-2/indexdb/id_563.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=563 // -let index = (B07 - B04) / (B07 + B04); -let min = -0.889; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B07", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B07 - sample.B04) / (sample.B07 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_564.js b/sentinel-2/indexdb/id_564.js index d7df27ce..ad91d51e 100644 --- a/sentinel-2/indexdb/id_564.js +++ b/sentinel-2/indexdb/id_564.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=564 // -let index = -0.283 * B03 - 0.66 * B04 + 0.577 * B06 + 0.388 * B09; -let min = -0.244; -let max = 0.253; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.244; // Values below this appear as white (underflow) +var maxColorValue = 0.253; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = -0.283 * sample.B03 - 0.66 * sample.B04 + 0.577 * sample.B06 + 0.388 * sample.B09; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_565.js b/sentinel-2/indexdb/id_565.js index de7c7d8e..7120e667 100644 --- a/sentinel-2/indexdb/id_565.js +++ b/sentinel-2/indexdb/id_565.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=565 // -let index = 0.332 * B03 + 0.603 * B04 + 0.675 * B06 + 0.262 * B09; -let min = 0.137; -let max = 0.63; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.137; // Values below this appear as white (underflow) +var maxColorValue = 0.63; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 0.332 * sample.B03 + 0.603 * sample.B04 + 0.675 * sample.B06 + 0.262 * sample.B09; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_566.js b/sentinel-2/indexdb/id_566.js index 9a9223dc..4c2dc552 100644 --- a/sentinel-2/indexdb/id_566.js +++ b/sentinel-2/indexdb/id_566.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=566 // -let index = -0.899 * B03 + 0.428 * B04 + 0.076 * B06 - 0.041 * B09; -let min = -0.315; -let max = 0.137; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.315; // Values below this appear as white (underflow) +var maxColorValue = 0.137; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = -0.899 * sample.B03 + 0.428 * sample.B04 + 0.076 * sample.B06 - 0.041 * sample.B09; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_567.js b/sentinel-2/indexdb/id_567.js index 987ad702..91c94051 100644 --- a/sentinel-2/indexdb/id_567.js +++ b/sentinel-2/indexdb/id_567.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=567 // -let index = -0.016 * B03 + 0.131 * B04 - 0.425 * B06 + 0.882 * B09; -let min = -0.107; -let max = 0.342; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.107; // Values below this appear as white (underflow) +var maxColorValue = 0.342; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = -0.016 * sample.B03 + 0.131 * sample.B04 - 0.425 * sample.B06 + 0.882 * sample.B09; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_568.js b/sentinel-2/indexdb/id_568.js index 1a8c3975..aa312488 100644 --- a/sentinel-2/indexdb/id_568.js +++ b/sentinel-2/indexdb/id_568.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=568 // -let index = B04 / B08; -let min = 0.06; -let max = 17.169; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.06; // Values below this appear as white (underflow) +var maxColorValue = 17.169; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B04 / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_569.js b/sentinel-2/indexdb/id_569.js index 6d903ced..50bafea5 100644 --- a/sentinel-2/indexdb/id_569.js +++ b/sentinel-2/indexdb/id_569.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=569 // -let index = 2.4 * B09 - B04; -let min = -0.288; -let max = 0.865; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.288; // Values below this appear as white (underflow) +var maxColorValue = 0.865; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 2.4 * sample.B09 - sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_57.js b/sentinel-2/indexdb/id_57.js index 4ea55ea5..19db68ef 100644 --- a/sentinel-2/indexdb/id_57.js +++ b/sentinel-2/indexdb/id_57.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=57 // -let index = (B11 - B12) / (B11 + B12); -let min = -0.889; -let max = 0.892; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.892; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B11 - sample.B12) / (sample.B11 + sample.B12); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_570.js b/sentinel-2/indexdb/id_570.js index e538e4dd..5c04e258 100644 --- a/sentinel-2/indexdb/id_570.js +++ b/sentinel-2/indexdb/id_570.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=570 // -let index = 0.406 * B03 + 0.6 * B04 + 0.645 * B06 + 0.243 * B09; -let min = 0.14; -let max = 0.637; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.14; // Values below this appear as white (underflow) +var maxColorValue = 0.637; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 0.406 * sample.B03 + 0.6 * sample.B04 + 0.645 * sample.B06 + 0.243 * sample.B09; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_571.js b/sentinel-2/indexdb/id_571.js index 5212ea9b..706ae131 100644 --- a/sentinel-2/indexdb/id_571.js +++ b/sentinel-2/indexdb/id_571.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=571 // -let index = -0.386 * B03 - 0.53 * B04 + 0.535 * B06 + 0.532 * B09; -let min = -0.222; -let max = 0.284; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.222; // Values below this appear as white (underflow) +var maxColorValue = 0.284; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = -0.386 * sample.B03 - 0.53 * sample.B04 + 0.535 * sample.B06 + 0.532 * sample.B09; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_572.js b/sentinel-2/indexdb/id_572.js index cb3f384b..3de95ab1 100644 --- a/sentinel-2/indexdb/id_572.js +++ b/sentinel-2/indexdb/id_572.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=572 // -let index = 0.723 * B03 - 0.597 * B04 + 0.206 * B06 - 0.278 * B09; -let min = -0.232; -let max = 0.255; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.232; // Values below this appear as white (underflow) +var maxColorValue = 0.255; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 0.723 * sample.B03 - 0.597 * sample.B04 + 0.206 * sample.B06 - 0.278 * sample.B09; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_573.js b/sentinel-2/indexdb/id_573.js index a173e4cd..ea0950fe 100644 --- a/sentinel-2/indexdb/id_573.js +++ b/sentinel-2/indexdb/id_573.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=573 // -let index = 0.404 * B03 - 0.039 * B04 - 0.505 * B06 + 0.762 * B09; -let min = -0.116; -let max = 0.371; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B06", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.116; // Values below this appear as white (underflow) +var maxColorValue = 0.371; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 0.404 * sample.B03 - 0.039 * sample.B04 - 0.505 * sample.B06 + 0.762 * sample.B09; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_574.js b/sentinel-2/indexdb/id_574.js index d3f0cb9c..9be6f1f4 100644 --- a/sentinel-2/indexdb/id_574.js +++ b/sentinel-2/indexdb/id_574.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=574 // -let index = 2.0 * B09 - B04; -let min = -0.298; -let max = 0.713; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B09", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.298; // Values below this appear as white (underflow) +var maxColorValue = 0.713; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 2.0 * sample.B09 - sample.B04; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_576.js b/sentinel-2/indexdb/id_576.js index 98f6c749..af0d7e13 100644 --- a/sentinel-2/indexdb/id_576.js +++ b/sentinel-2/indexdb/id_576.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=576 // -let index = 2.5 * (B08 - B04) / (B08 + 2.4 * B04 + 1.0); -let min = -0.438; -let max = 0.582; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.438; // Values below this appear as white (underflow) +var maxColorValue = 0.582; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 2.5 * (sample.B08 - sample.B04) / (sample.B08 + 2.4 * sample.B04 + 1.0); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_58.js b/sentinel-2/indexdb/id_58.js index 6614c7d7..30bd9073 100644 --- a/sentinel-2/indexdb/id_58.js +++ b/sentinel-2/indexdb/id_58.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=58 // -let index = (B08 - B04) / (B08 + B04); -let min = -0.892; -let max = 0.889; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.892; // Values below this appear as white (underflow) +var maxColorValue = 0.889; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_59.js b/sentinel-2/indexdb/id_59.js index 712aee26..8593d2a3 100644 --- a/sentinel-2/indexdb/id_59.js +++ b/sentinel-2/indexdb/id_59.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=59 // -let index = (B12 - B08) / (B12 + B08); -let min = -0.889; -let max = 0.892; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.892; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B12 - sample.B08) / (sample.B12 + sample.B08); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_63.js b/sentinel-2/indexdb/id_63.js index 0e3cc6a8..211dc58d 100644 --- a/sentinel-2/indexdb/id_63.js +++ b/sentinel-2/indexdb/id_63.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=63 // -let index = (1.0 + 0.16) * (B08 - B04) / (B08 + B04 + 0.16); -let min = -0.705; -let max = 0.704; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.705; // Values below this appear as white (underflow) +var maxColorValue = 0.704; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (1.0 + 0.16) * (sample.B08 - sample.B04) / (sample.B08 + sample.B04 + 0.16); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_64.js b/sentinel-2/indexdb/id_64.js index d8cfcf96..04b38bcb 100644 --- a/sentinel-2/indexdb/id_64.js +++ b/sentinel-2/indexdb/id_64.js @@ -7,31 +7,76 @@ // // Initialize parameters -let a = 0.149; -let ar = 0.374; -let b = 0.735; - -let index = (1.0 / Math.sqrt(Math.pow(a, 2.0) + 1.0)) * (B08 - ar - b); -let min = -1.58; -let max = 0.101; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08SCL dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -1.58; // Values below this appear as white (underflow) +var maxColorValue = 0.101; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let a = 0.149; + let ar = 0.374; + let b = 0.735; + + let index = (1.0 / Math.sqrt(Math.pow(a, 2.0) + 1.0)) * (sample.B08 - ar - b); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_71.js b/sentinel-2/indexdb/id_71.js index 9833738e..c2049351 100644 --- a/sentinel-2/indexdb/id_71.js +++ b/sentinel-2/indexdb/id_71.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=71 // -let index = B12 / B08; -let min = 0.059; -let max = 17.125; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.125; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B12 / sample.B08; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_72.js b/sentinel-2/indexdb/id_72.js index 4d91b8fa..85e3567d 100644 --- a/sentinel-2/indexdb/id_72.js +++ b/sentinel-2/indexdb/id_72.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=72 // -let index = B08 / B04; -let min = 0.059; -let max = 17.48; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.059; // Values below this appear as white (underflow) +var maxColorValue = 17.48; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / sample.B04; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_74.js b/sentinel-2/indexdb/id_74.js index 42789692..31cb6cee 100644 --- a/sentinel-2/indexdb/id_74.js +++ b/sentinel-2/indexdb/id_74.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=74 // -let index = (B04 - B03) / (B04 + B03); -let min = -0.891; -let max = 0.89; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.891; // Values below this appear as white (underflow) +var maxColorValue = 0.89; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B04 - sample.B03) / (sample.B04 + sample.B03); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_75.js b/sentinel-2/indexdb/id_75.js index 5d0148d0..95c3bbee 100644 --- a/sentinel-2/indexdb/id_75.js +++ b/sentinel-2/indexdb/id_75.js @@ -7,30 +7,75 @@ // // Initialize parameters -let MIRmin = 0.259; -let MIRmax = 0.640; - -let index = B08 / B04 * MIRmax - B12 / MIRmax - MIRmin; -let min = -0.734; -let max = 10.383; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.734; // Values below this appear as white (underflow) +var maxColorValue = 10.383; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let MIRmin = 0.259; + let MIRmax = 0.640; + + let index = sample.B08 / sample.B04 * MIRmax - sample.B12 / MIRmax - MIRmin; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_76.js b/sentinel-2/indexdb/id_76.js index f9f4928f..c3dda199 100644 --- a/sentinel-2/indexdb/id_76.js +++ b/sentinel-2/indexdb/id_76.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=76 // -let index = (B08 - B04) / Math.sqrt(B08 + B04) * 0.5; -let min = -0.266; -let max = 0.266; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.266; // Values below this appear as white (underflow) +var maxColorValue = 0.266; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B04) / Math.sqrt(sample.B08 + sample.B04) * 0.5; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_79.js b/sentinel-2/indexdb/id_79.js index 1c8dd506..ecee3992 100644 --- a/sentinel-2/indexdb/id_79.js +++ b/sentinel-2/indexdb/id_79.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=79 // -let index = (2.0 * B04 - B03 - B02) / (B03 - B02); -let min = -66.488; -let max = 65.829; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -66.488; // Values below this appear as white (underflow) +var maxColorValue = 65.829; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (2.0 * sample.B04 - sample.B03 - sample.B02) / (sample.B03 - sample.B02); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_87.js b/sentinel-2/indexdb/id_87.js index 07a0323b..5f6d655b 100644 --- a/sentinel-2/indexdb/id_87.js +++ b/sentinel-2/indexdb/id_87.js @@ -7,29 +7,74 @@ // // Initialize parameters -let L = 0.725; - -let index = (B08 - B04) / (B08 + B04 + L) * (1.0 + L); -let min = -0.512; -let max = 0.512; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.512; // Values below this appear as white (underflow) +var maxColorValue = 0.512; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let L = 0.725; + + let index = (sample.B08 - sample.B04) / (sample.B08 + sample.B04 + L) * (1.0 + L); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_88.js b/sentinel-2/indexdb/id_88.js index c42231b4..19b505fb 100644 --- a/sentinel-2/indexdb/id_88.js +++ b/sentinel-2/indexdb/id_88.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=88 // -let index = (B11 - B08) / (B11 + B08); -let min = -0.889; -let max = 0.891; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B08", "B11", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.889; // Values below this appear as white (underflow) +var maxColorValue = 0.891; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B11 - sample.B08) / (sample.B11 + sample.B08); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_89.js b/sentinel-2/indexdb/id_89.js index f6145d3b..d58ffe7d 100644 --- a/sentinel-2/indexdb/id_89.js +++ b/sentinel-2/indexdb/id_89.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=89 // -let index = B08 / (B04 + B12); -let min = 0.032; -let max = 3.228; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.032; // Values below this appear as white (underflow) +var maxColorValue = 3.228; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = sample.B08 / (sample.B04 + sample.B12); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_90.js b/sentinel-2/indexdb/id_90.js index 70308179..da8b60e9 100644 --- a/sentinel-2/indexdb/id_90.js +++ b/sentinel-2/indexdb/id_90.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=90 // -let index = (B08 - B01) / (B08 - B04); -let min = -32.166; -let max = 33.194; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B01", "B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -32.166; // Values below this appear as white (underflow) +var maxColorValue = 33.194; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = (sample.B08 - sample.B01) / (sample.B08 - sample.B04); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_91.js b/sentinel-2/indexdb/id_91.js index 5d5e04ad..f44aa266 100644 --- a/sentinel-2/indexdb/id_91.js +++ b/sentinel-2/indexdb/id_91.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=91 // -let index = 0.3037 * B02 + 0.2793 * B03 + 0.4743 * B04 + 0.5585 * B08 + 0.5082 * B10 + 0.1863 * B12; -let min = 0.22; -let max = 0.727; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "B08", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.22; // Values below this appear as white (underflow) +var maxColorValue = 0.727; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 0.3037 * sample.B02 + 0.2793 * sample.B03 + 0.4743 * sample.B04 + 0.5585 * sample.B08 + 0.5082 * B10 + 0.1863 * sample.B12; + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_92.js b/sentinel-2/indexdb/id_92.js index b98fe533..84d4d953 100644 --- a/sentinel-2/indexdb/id_92.js +++ b/sentinel-2/indexdb/id_92.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=92 // -let index = -0.2848 * B02 - 0.2435 * B03 - 0.5436 * B04 + 0.7243 * B08 + 0.084 * B11 - 0.18 * B12; -let min = -0.337; -let max = 0.155; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "B08", "B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.337; // Values below this appear as white (underflow) +var maxColorValue = 0.155; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = -0.2848 * sample.B02 - 0.2435 * sample.B03 - 0.5436 * sample.B04 + 0.7243 * sample.B08 + 0.084 * sample.B11 - 0.18 * sample.B12; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_93.js b/sentinel-2/indexdb/id_93.js index 34caadf3..6b37ed91 100644 --- a/sentinel-2/indexdb/id_93.js +++ b/sentinel-2/indexdb/id_93.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=93 // -let index = 0.1509 * B02 + 0.1973 * B03 + 0.3279 * B04 + 0.3406 * B08 - 0.7112 * B11 - 0.4572 * B12; -let min = -0.279; -let max = 0.217; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B02", "B03", "B04", "B08", "B11", "B12", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -0.279; // Values below this appear as white (underflow) +var maxColorValue = 0.217; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 0.1509 * sample.B02 + 0.1973 * sample.B03 + 0.3279 * sample.B04 + 0.3406 * sample.B08 - 0.7112 * sample.B11 - 0.4572 * sample.B12; + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_96.js b/sentinel-2/indexdb/id_96.js index c9784d9b..cb64efd4 100644 --- a/sentinel-2/indexdb/id_96.js +++ b/sentinel-2/indexdb/id_96.js @@ -6,27 +6,71 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=96 // -let index = 3.0 * ((B05 - B04) - 0.2 * (B05 - B03) * (B05 / B04)); -let min = -1.066; -let max = 1.073; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "B05", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -1.066; // Values below this appear as white (underflow) +var maxColorValue = 1.073; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = 3.0 * ((sample.B05 - sample.B04) - 0.2 * (sample.B05 - sample.B03) * (sample.B05 / sample.B04)); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_97.js b/sentinel-2/indexdb/id_97.js index b9692dc5..4da0402b 100644 --- a/sentinel-2/indexdb/id_97.js +++ b/sentinel-2/indexdb/id_97.js @@ -7,31 +7,76 @@ // // Initialize parameters -let X = 0.114; -let A = 0.824; -let B = 0.421; - -let index = (B * (B08 - B * B04 - A)) / (B04 + B * (B08 - A) + X * (1.0 + Math.pow(B, 2.0))); -let min = -72.144; -let max = 72.049; -let zero = 0.0; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. -// This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let zero_color = [0, 147/255, 146/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, zero, max], -[ - underflow_color, - low_color, - zero_color, // divergent step at zero - high_color, - //overflow_color // uncomment to see overflows -]); + +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B04", "B08", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = -72.144; // Values below this appear as white (underflow) +var maxColorValue = 72.049; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let X = 0.114; + let A = 0.824; + let B = 0.421; + + let index = (B * (sample.B08 - B * sample.B04 - A)) / (sample.B04 + B * (sample.B08 - A) + X * (1.0 + Math.pow(B, 2.0))); + let zero = 0.0; + + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + // This index crosses zero, so a diverging color map is used. To tweak the value of the break in the color map, change the variable 'zero'. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let zero_color = [0, 147/255, 146/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, zero, maxColorValue], + [ + underflow_color, + low_color, + zero_color, // divergent step at zero + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} + diff --git a/sentinel-2/indexdb/id_98.js b/sentinel-2/indexdb/id_98.js index 2deeaa11..6698653d 100644 --- a/sentinel-2/indexdb/id_98.js +++ b/sentinel-2/indexdb/id_98.js @@ -6,23 +6,66 @@ // URL https://www.indexdatabase.de/db/si-single.php?sensor_id=96&rsindex_id=98 // -let index = Math.sqrt((((B04 - B03) / (B04 + B03))) + 0.5); -let min = 0.134; -let max = 1.182; - -// colorBlend will return a color when the index is between min and max and white when it is less than min. -// To see black when it is more than max, uncomment the last line of colorBlend. -// The min/max values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. - -let underflow_color = [1, 1, 1]; -let low_color = [208/255, 88/255, 126/255]; -let high_color = [241/255, 234/255, 200/255]; -let overflow_color = [0, 0, 0]; - -return colorBlend(index, [min, min, max], -[ - underflow_color, - low_color, - high_color, - //overflow_color // uncomment to see overflows -]); +// Set USE_SCL_CLOUD_MASKING to false to disable cloud/shadow/water masking +var USE_SCL_CLOUD_MASKING = true; + +function setup() { + return { + input: ["B03", "B04", "SCL", "dataMask"], + output: [ + { id: "default", bands: 4 }, + { id: "index", bands: 1, sampleType: "FLOAT32" }, + { id: "eobrowserStats", bands: 1, sampleType: "FLOAT32" }, + { id: "dataMask", bands: 1 } + ] + }; + +} + +// USER-CONFIGURABLE PARAMETERS +// Adjust these values to rescale the color palette visualization: +var minColorValue = 0.134; // Values below this appear as white (underflow) +var maxColorValue = 1.182; // Values above this appear as black (overflow) + +const cloud_palette = { + 0: [0, 0, 0], // No Data (Missing data) - black + 1: [1, 0, 0.016], // Saturated or defective pixel - red + 2: [0.525, 0.525, 0.525], // Topographic casted shadows - very dark grey + 3: [0.467, 0.298, 0.043], // Cloud shadows - dark brown + 6: [0, 0, 1], // Water (dark and bright) - blue + 7: [0.506, 0.506, 0.506], // Unclassified - dark grey + 8: [0.753, 0.753, 0.753], // Cloud medium probability - grey + 9: [0.949, 0.949, 0.949], // Cloud high probability - white + 10: [0.733, 0.773, 0.925], // Thin cirrus - very bright blue + 11: [0.325, 1, 0.980], // Snow or ice - very bright pink +}; + +function evaluatePixel(sample) { let index = Math.sqrt((((sample.B04 - sample.B03) / (sample.B04 + sample.B03))) + 0.5); + // colorBlend will return a color when the index is between minColorValue and maxColorValue and white when it is less than minColorValue. + // To see black when it is more than maxColorValue, uncomment the last line of colorBlend. + // The minColorValue/maxColorValue values were computed automatically and may be poorly specified, feel free to change them to tweak the displayed range. + + let underflow_color = [1, 1, 1]; + let low_color = [208/255, 88/255, 126/255]; + let high_color = [241/255, 234/255, 200/255]; + let overflow_color = [0, 0, 0]; + + let imgVals = colorBlend(index, [minColorValue, minColorValue, maxColorValue], + [ + underflow_color, + low_color, + high_color, + //overflow_color // uncomment to see overflows + ]); + let is_clouds = USE_SCL_CLOUD_MASKING && Object.keys(cloud_palette).includes(sample.SCL.toString()); + if (is_clouds) { + imgVals = cloud_palette[sample.SCL]; + } + return { + default: imgVals.concat(sample.dataMask), + index: [is_clouds ? NaN : index], + eobrowserStats: [is_clouds ? NaN : index], + dataMask: [sample.dataMask] + }; +} +