Skip to content

Commit e367a11

Browse files
azlinszkysinergisechorngjonasViehweger
authored
Added details to the s-1 flood visualization script, making it compatible with CDSE and adding explanation (#324)
* added copernicus browser and mosaic to s1 flood visualization * additional text and image explaining use * corrected evalscripturl * added new figure * requested changes implemented * started page for S1 mosaics * started editing custom sripts for Sentinel-1 mosaics * Add s1 mosaic collection id to layout * Automatic formatting of scripts --------- Co-authored-by: chorng <[email protected]> Co-authored-by: Jonas Viehweger <[email protected]>
1 parent 5822ea0 commit e367a11

File tree

8 files changed

+187
-2
lines changed

8 files changed

+187
-2
lines changed

_layouts/script.html

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
S5_O3: S5_O3_CDAS
1616
S5_SO2: S5_SO2_CDAS
1717
S1_AWS_EW_HHHV: S1_CDAS_EW_HHHV
18+
S1_MOSAIC: 3c662330-108b-4378-8899-525fd5a225cb
1819
---
1920

2021
<h1 class="d-inline" id={{page.slug}}> {{page.title}} </h1>

data-fusion/s1_flooding_visualisation/README.md

+40-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ parent: Data Fusion
44
layout: script
55
permalink: /data-fusion/s1_flooding_visualisation/
66
nav_exclude: true
7+
scripts:
8+
- [EO Browser, script.js]
9+
- [Copernicus Browser, copernicus_browser.js]
10+
- [Sentinel-2 mosaic, mosaic.js]
11+
examples:
12+
- zoom: '12'
13+
lat: '51.98266'
14+
lng: '-2.21409'
15+
datasetId: S1GRD
16+
fromTime: '2021-01-28T00:00:00.000Z'
17+
toTime: '2021-01-28T23:59:59.999Z'
18+
datasetId: S2L2A
19+
fromTime: '2021-02-28T00:00:00.000Z'
20+
toTime: '2021-02-28T23:59:59.999Z'
21+
platform:
22+
- CDSE
23+
- EOB
24+
evalscripturl: https://custom-scripts.sentinel-hub.com/custom-scripts/data-fusion/s1_flooding_visualisation/copernicus_browser.js
25+
726
---
827

928

@@ -14,12 +33,31 @@ nav_exclude: true
1433

1534
## Evaluate and visualize
1635
- [EO Browser](https://sentinelshare.page.link/i2yk)
36+
- [Copernicus Browser](https://link.dataspace.copernicus.eu/2ufw)
1737

1838
## General description of the script
1939

20-
This script can be used to visualise flood events using Sentinel-1 GRD imagery. This is especially useful for areas of interest that are affected by cloud cover (common during flood events caused by excessive rainfall). The script uses a threshold of -15 decibels to classify flooded pixels. This value can be adjusted to suit your area of interest. In addition, to help the viewer orientate themselves, a clear Sentinel-2 image is used as the basemap for this visualisation so that it can be easily interpreted where the flood extent reaches for those unfamiliar with interpreting SAR images.
40+
This script can be used to visualise flood events using Sentinel-1 GRD imagery. This is especially useful for areas of interest that are affected by cloud cover (common during flood events caused by excessive rainfall). The script uses a threshold of -15 decibels to classify flooded pixels. This value can be adjusted to suit your area of interest using the `lim` parameter. In addition, to help the viewer orientate themselves, a clear Sentinel-2 image is used as the basemap for this visualisation so that it can be easily interpreted where the flood extent reaches for those unfamiliar with interpreting SAR images.
41+
42+
### How to use
43+
44+
- Select your area of interest
45+
- From Data Collections, select `Sentinel-2 Mosaic` or `Sentinel-2 L2A`. You can choose the most recent mosaic or the one from the same season as your time of interest; if you are selecting a single image, make sure it is cloud free.
46+
- From Layers, select Custom Script. Click the Custom Script tab, and check the `Use additional datasets (advanced)` box. Under `Additional datasets`, you will see `S-1 GRD`. Click the `+` Sign to add it. Make sure you enable orthorectification. Optionally, you can also use a speckle filter.
47+
- Check the `Customize timespan` box and select the timeframe you are interested in (the timeframe of your flood)
48+
- Now paste the script in the code field. Take care to use the right one, `Copernicus Browser` if you are using a single Sentinel-2 image as a background and `Sentinel-2 Mosaic` if you want the mosaic background. Then click `Refresh Evalscript`.
49+
- If you want to adjust the brightness of the background image, change the `f` constant. It is typically around 2.5 for Sentinel-2 images and 0.0008 for Sentinel-2 mosaics, increasing the gain makes the image brighter.
50+
51+
### Interpretation of results
52+
53+
Flooded areas will be marked in blue. Since this is a SAR dataset, the resulting map is affected by SAR speckle. In some cases, wet vegetation fields, steep slopes facing away from the sensor, or large flat surfaces such as airports can also create low backscatter and can thus be mistaken for flooded areas. Therefore, the 3D view can also be helpful for interpreting results: flooded areas are usually in the valley bottoms.
54+
55+
**Verification of flooding on a 3D image**
56+
![Verification of flooding](fig/fig2.jpg)
2157

2258
## Description of representative images
23-
59+
60+
In late 2023 and early 2024, north-western Europe experienced very high levels of rainfall, which led to widespread river flooding. This scene shows the Severn River upstream of Gloucester on 01 January 2024, with a Sentinel-2 image from 28 February 2024 as a background.
61+
2462
**Flooding in the UK 28th January 2021**
2563
![flooding](fig/fig1.jpg)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//VERSION=3
2+
function setup() {
3+
return {
4+
input: [
5+
{
6+
datasource: "S2L2A",
7+
bands: ["B08"],
8+
},
9+
{
10+
datasource: "S1GRD",
11+
bands: ["VV", "dataMask"],
12+
},
13+
],
14+
output: { bands: 4 },
15+
mosaicking: "SIMPLE",
16+
};
17+
}
18+
19+
function toDB(input) {
20+
return (10 * Math.log(input)) / Math.LN10;
21+
}
22+
23+
//threshold value for water detection, reduce for more water, increase for less water
24+
const lim = 15;
25+
//gain value for image brightness (increase for brighter image)
26+
const f = 2.5;
27+
28+
function evaluatePixel(sample) {
29+
var S1 = sample.S1GRD[0];
30+
var S2 = sample.S2L2A[0];
31+
if (toDB(S1.VV) <= -1 * lim) {
32+
return [S1.VV * 10, S1.VV * 10, S1.VV * 50, 1];
33+
} else {
34+
return [f * S2.B08, f * S2.B08, f * S2.B08, 1];
35+
}
36+
}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//VERSION=3
2+
function setup() {
3+
return {
4+
input: [
5+
{
6+
datasource: "CUSTOM",
7+
bands: ["B02", "B03", "B04"],
8+
},
9+
{
10+
datasource: "S1GRD",
11+
bands: ["VV", "VH", "dataMask"],
12+
},
13+
],
14+
output: { bands: 4 },
15+
mosaicking: "SIMPLE",
16+
};
17+
}
18+
19+
function toDB(input) {
20+
return (10 * Math.log(input)) / Math.LN10;
21+
}
22+
//threshold value for water detection, reduce for more water, increase for less water
23+
const lim = 15;
24+
//gain value for image brightness (increase for brighter image)
25+
const f = 0.0008;
26+
27+
function evaluatePixel(sample) {
28+
var S1 = sample.S1GRD[0];
29+
var S2 = sample.CUSTOM[0];
30+
if (toDB(S1.VV) <= -1 * lim) {
31+
return [S1.VV * 10, S1.VV * 10, S1.VV * 50, 1];
32+
} else {
33+
return [f * S2.B04, f * S2.B03, f * S2.B02, 1];
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: RGB Ratio Script
3+
parent: Sentinel-1
4+
grand_parent: Sentinel
5+
layout: script
6+
permalink: /sentinel1-monthly-mosaic/rgb_ratio/
7+
nav_exclude: true
8+
examples:
9+
- zoom: '11'
10+
lat: '53.62774'
11+
lng: '9.61716'
12+
datasetId: S1_MOSAIC
13+
fromTime: '2023-09-01T00:00:00.000Z'
14+
toTime: '2023-09-01T23:59:59.999Z'
15+
platform:
16+
- CDSE
17+
evalscripturl: https://custom-scripts.sentinel-hub.com/custom-scripts/sentinel1-monthly-mosaic/rgb_ratio/script.js
18+
---
19+
20+
## Collection Access
21+
22+
[Sentinel-1 Monthly Mosaic](https://documentation.dataspace.copernicus.eu/APIs/SentinelHub/Data/S1GRD.html) is one of the [Sentinel-1 products](https://documentation.dataspace.copernicus.eu/Data/SentinelMissions/Sentinel1.html), that is offered in [Copernicus Data Space Ecosystem](https://dataspace.copernicus.eu/). The data is accessible via [Copernicus Browser](https://browser.dataspace.copernicus.eu/). To access the data, you need a [Copernicus Data Space Ecosystem account](https://documentation.dataspace.copernicus.eu/Registration.html), and then either create a [Sentinel Hub Process API request](https://documentation.dataspace.copernicus.eu/APIs/SentinelHub/Process.html) to the collection or to visualise the data via [Copernicus Browser](https://link.dataspace.copernicus.eu/h9t). The collection ID is `3c662330-108b-4378-8899-525fd5a225cb`.
23+
24+
[comment]: (and the collection type is `byoc-5460de54-082e-473a-b6ea-d5cbe3c17cca`.: # )
25+
26+
## General description of the script
27+
28+
This script combines the gamma0 of the VV and VH polarizations into a false color visualization. It uses the VV polarization in the red channel, the VH polarization in the green channel, and a ratio of VH/VV in the blue channel. It shows water areas in dark red (black), urban areas in yellow, vegetated areas in turquoise, and bare ground in dark purple.
29+
30+
For snowy and icy areas, the visualization can vary from light yellow to blue to red. In order not to confuse cryogenic features with non-cryogenic ones, some general information about the location is helpful in interpreting the image.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//VERSION=3
2+
function setup() {
3+
return {
4+
input: ["VV", "VH", "dataMask"],
5+
output: { bands: 3 },
6+
};
7+
}
8+
9+
var viz = new HighlightCompressVisualizer(0, 0.8);
10+
var gain = 0.8;
11+
12+
function evaluatePixel(sample) {
13+
if (sample.dataMask == 0) {
14+
return [0, 0, 0];
15+
}
16+
17+
let vals = [
18+
(gain * sample.VV) / 0.28,
19+
(gain * sample.VH) / 0.06,
20+
(gain * sample.VH) / sample.VV / 0.49,
21+
];
22+
23+
return viz.processList(vals);
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: default
3+
title: Sentinel-1 Monthly Mosaic
4+
nav_order: 5
5+
parent: Sentinel
6+
permalink: /sentinel/sentinel1-monthly-mosaic/
7+
---
8+
9+
# Sentinel-1 Monthly Mosaic
10+
11+
Sentinel-1 Monthly mosaics are an analysis-ready product of individual Sentinel-1 acquisitions. The dataset is prepared for most populated areas of the world. Two separate data products are available: Sentinel-1 IW Monthly Mosaics for the temperate zone and the tropics with VV and VH polarization, and Sentinel-1 DH Monthly Mosaics with HH and HV polarization for the polar regions. The resolution of the collection is 20 meters.
12+
13+
The algorithm used to derive the product was run independently at pixel level. For each pixel and each band, a weighted average of the pixel values was calculated. The weights were calculated based on the local resolution (the inverse of the imaged area) that particular pixel. The imaged area is a function of the sensor configuration (look angle and azimuth) and the local terrain aspect and slope. If the slope is facing towards the sensor, the imaged area is small and returned intensity will be high, while if it is facing away from the sensor, the the imaged area is large and the returned intensity will be low or even zero for radar shadows.
14+
For more details of this correction process, visit [(Small 2012)](https://ieeexplore.ieee.org/abstract/document/6350465).
15+
16+
Please find related resources and more information about the collection [here](https://documentation.dataspace.copernicus.eu/APIs/SentinelHub/Data/S1GRD.html#processing-chain).
17+
18+
- [RGB ratio](/sentinel1-monthly-mosaic/rgb_ratio)
19+
- [False Color](/sentinel2-quarterly-cloudless-mosaic/false-color)
20+
- [NDVI](/sentinel2-quarterly-cloudless-mosaic/ndvi)
21+
- [NDWI](/sentinel2-quarterly-cloudless-mosaic/ndwi)

0 commit comments

Comments
 (0)