Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 63 additions & 20 deletions sentinel-2/indexdb/id_1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
};
}

97 changes: 71 additions & 26 deletions sentinel-2/indexdb/id_104.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
};
}

92 changes: 68 additions & 24 deletions sentinel-2/indexdb/id_109.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
};
}

92 changes: 68 additions & 24 deletions sentinel-2/indexdb/id_11.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
};
}

Loading