Skip to content

Commit 07ca391

Browse files
added penguin locator custom script for Sentinel-2, including editing the Sentinel-2.md
1 parent 03c7f52 commit 07ca391

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Penguin Locator
3+
parent: Sentinel-2
4+
grand_parent: Sentinel
5+
layout: script
6+
permalink: /sentinel-2/penguin_locator/
7+
nav_exclude: true
8+
examples:
9+
- zoom: '10'
10+
lat: '66.4630'
11+
lng: '-38.46067'
12+
datasetId: S2L2A
13+
fromTime: '2025-07-19T00:00:00.000Z'
14+
toTime: '2025-07-19T23:59:59.999Z'
15+
platform:
16+
- CDSE
17+
evalscripturl: https://custom-scripts.sentinel-hub.com/custom-scripts/sentinel/sentinel-2/penguin_locator/script.js
18+
---
19+
20+
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.
21+
22+
23+
## General description of the script
24+
25+
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.
26+
27+
## References
28+
29+
- See more in this legendary gallery feature: https://dataspace.copernicus.eu/gallery/2024-9-28-monitoring-penguins-space
30+
- Big thanks to Rafał for his ongoing contributions to CDSE!
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//VERSION=3
2+
3+
//Penguin Locator custom script by Rafał Wereszszynski (@kosmi.bluesky.social), adapted to Version 3 by András Zlinszky and Github Copilot.
4+
//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.
5+
//By reducing oversaturation and highlighting small differences, patterns in snow and ice dominated landscapes stand out, including marks of penguin colonies.
6+
7+
function setup() {
8+
return {
9+
input: ["B02", "B03", "B04", "B08"],
10+
output: { bands: 3 }
11+
};
12+
}
13+
14+
function evaluatePixel(sample) {
15+
var r = Math.sqrt(0.6 * sample.B08) - 0.1;
16+
var g = Math.sqrt(0.6 * sample.B04) - 0.1;
17+
var b = Math.sqrt(0.6 * sample.B03) - 0.1;
18+
19+
var r2 = Math.sqrt(0.6 * sample.B08) - 0.1;
20+
var g2 = Math.sqrt(0.6 * sample.B03) - 0.1;
21+
var b2 = Math.sqrt(0.6 * sample.B02) - 0.1;
22+
23+
var dark = 7;
24+
25+
var dif1 = (1 - ((r + r2) / 2)) / dark;
26+
var dif2 = (1 - ((g + g2) / 2)) / dark;
27+
var dif3 = (1 - ((b + b2) / 2)) / dark;
28+
29+
var r3 = ((r + r2) / 2) - dif1;
30+
var g3 = ((g + g2) / 2) - dif2;
31+
var b3 = ((b + b2) / 2) - dif3;
32+
33+
return [r3, g3, b3];
34+
}

sentinel-2/sentinel-2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Dedicated to supplying data for [Copernicus services](https://www.esa.int/Our_Ac
8787
- [Monthly snow report](/sentinel-2/monthly_snow_report)
8888
- [Snow cover change detection](/sentinel-2/snow_cover_change)
8989
- [NDSI Visualized](/sentinel-2/ndsi) - Visualized normalized difference snow index
90+
- [Penguin Locator](/sentinel-2/penguin_locator) - Highlights subtle patterns on the snow and ice surface
9091

9192
#### Disaster management and prevention algorithms
9293
- [Detecting deep moist convection](/sentinel-2/deep_moist_convection)

0 commit comments

Comments
 (0)