Sentinel-2 L2A Quarterly Cloudless Mosaic - True Color
//VERSION=3
function setup() {
return {
input: ["B04", "B03", "B02", "dataMask"],
output: { bands: 4 }
};
}
// Contrast enhance / highlight compress
const maxR = 3.0; // max reflectance
const midR = 0.13;
const sat = 1.2;
const gamma = 1.8;
const scalefac = 10000;
function evaluatePixel(smp) {
const rgbLin = satEnh(sAdj(smp.B04 / scalefac), sAdj(smp.B03 / scalefac), sAdj(smp.B02 / scalefac));
return [sRGB(rgbLin[0]), sRGB(rgbLin[1]), sRGB(rgbLin[2]), smp.dataMask];
}
function sAdj(a) {
return adjGamma(adj(a, midR, 1, maxR));
}
const gOff = 0.01;
const gOffPow = Math.pow(gOff, gamma);
const gOffRange = Math.pow(1 + gOff, gamma) - gOffPow;
function adjGamma(b) {
return (Math.pow((b + gOff), gamma) - gOffPow) / gOffRange;
}
// Saturation enhancement
function satEnh(r, g, b) {
const avgS = (r + g + b) / 3.0 * (1 - sat);
return [clip(avgS + r * sat), clip(avgS + g * sat), clip(avgS + b * sat)];
}
function clip(s) {
return s < 0 ? 0 : s > 1 ? 1 : s;
}
//contrast enhancement with highlight compression
function adj(a, tx, ty, maxC) {
var ar = clip(a / maxC, 0, 1);
return ar * (ar * (tx / maxC + ty - 1) - ty) / (ar * (2 * tx / maxC - 1) - tx / maxC);
}
const sRGB = (c) => c <= 0.0031308 ? (12.92 * c) : (1.055 * Math.pow(c, 0.41666666666) - 0.055);
Evaluate and Visualize
Collection Access
Sentinel-2 L2A Quarterly Cloudless Mosaic is one of the Sentinel-2 products, that is offered in Copernicus Data Space Ecosystem. The data is accessible via Copernicus Browser. To access the data, you need a Copernicus Data Space Ecosystem account, and then either create a Sentinel Hub Process API request to the collection or to visualise the data via Copernicus Browser. The collection ID is 5460de54-082e-473a-b6ea-d5cbe3c17cca
, and the collection type is byoc-5460de54-082e-473a-b6ea-d5cbe3c17cca
.
General description
A true color composite uses visible light bands red, green and blue in the corresponding red, green and blue color channels, resulting in a natural colored product, that is a good representation of the Earth as humans would see it naturally. For Sentinel-2 L2A Quarterly Cloudless Mosaic, the contrast enhancement with highlight compression and the saturation enhencement were applied for better visualisation.
Description of representative images
True Color visualization of Iceland, 01.10.2023.