Penguin Locator

//VERSION=3

//Penguin Locator custom script by Rafał Wereszszynski (@kosmi.bluesky.social), adapted to Version 3 by András Zlinszky and Github Copilot.
//This script generages an RGB composite from the small differences between the red, green and blue bands of Sentinel-2 and assigning the adjusted values of the NIR band to the red channel.
//By reducing oversaturation and highlighting small differences, patterns in snow and ice dominated landscapes stand out, including marks of penguin colonies.

function setup() {
  return {
    input: ["B02", "B03", "B04", "B08"],
    output: { bands: 3 }
  };
}

function evaluatePixel(sample) {
  var r = Math.sqrt(0.6 * sample.B08) - 0.1;
  var g = Math.sqrt(0.6 * sample.B04) - 0.1;
  var b = Math.sqrt(0.6 * sample.B03) - 0.1;

  var r2 = Math.sqrt(0.6 * sample.B08) - 0.1;
  var g2 = Math.sqrt(0.6 * sample.B03) - 0.1;
  var b2 = Math.sqrt(0.6 * sample.B02) - 0.1;

  var dark = 7;

  var dif1 = (1 - ((r + r2) / 2)) / dark;
  var dif2 = (1 - ((g + g2) / 2)) / dark;
  var dif3 = (1 - ((b + b2) / 2)) / dark;

  var r3 = ((r + r2) / 2) - dif1;
  var g3 = ((g + g2) / 2) - dif2;
  var b3 = ((b + b2) / 2) - dif3;

  return [r3, g3, b3];
}

Evaluate and Visualize

The layout script automatically adds the title defined in the front matter and adds buttons to visualize the script. For the buttons to work the evalscript has to be named script.js and must be in the same directory as the README.md file.

General description of the script

This script aims to highlight small patterns in landscapes dominated by ice and snow. It does this by first square root transforming all bands, then adding the NIR band to the red channel (more sensitive to ice thickness and wetness than the visible bands), and calculating the differences between the red and green, and green and blue Sentinel-2 image bands respectively and assigning these to the green and blue channels of the visualized image. The result speaks for itself: subtle patterns in snow and ice cover are revealed, and objects on the surface such as penguin poop stand out, easy to notice.

References

  • See more in this legendary gallery feature: https://dataspace.copernicus.eu/gallery/2024-9-28-monitoring-penguins-space
  • Big thanks to Rafał for his ongoing contributions to CDSE!