---
title: "Satellite flood mapping with Sentinel-1 and Sentinel-2: the Valencia floods of October 2024"
description: "Map the 2024 Valencia floods with Sentinel-1 radar and Sentinel-2 in Python, then score the map against Copernicus EMS with a confusion matrix, F1 and IoU."
url: https://www.technicalgis.com/tutorials/satellite-flood-mapping-sentinel-1-sentinel-2/
author: Sean Blaney (https://www.technicalgis.com/about/#sean-blaney)
publisher: TechnicalGIS (https://www.technicalgis.com/about/)
published: 2026-11-24
updated: 2026-11-24
language: en-GB
---

# Satellite flood mapping with Sentinel-1 and Sentinel-2: the Valencia floods of October 2024

> Map the 2024 Valencia floods with Sentinel-1 radar and Sentinel-2 in Python, then score the map against Copernicus EMS with a confusion matrix, F1 and IoU.

- Level: Intermediate
- Tested with: Python 3.12
- Source code: [Download scripts](https://www.technicalgis.com/code/satellite-flood-mapping-sentinel-1-sentinel-2/)

Series · Part 2 of 6

## [GIS for disaster emergency response](https://www.technicalgis.com/tutorials/series/disaster-emergency-response-gis/)

1.  [Rapid situational mapping from open data in Python: the Valencia floods of 29 October 2024](https://www.technicalgis.com/tutorials/rapid-situational-mapping-open-data-python/)
2.  Satellite flood mapping with Sentinel-1 and Sentinel-2: the Valencia floods of October 2024

Part 3 is out 1 December 2026. [See the whole series](https://www.technicalgis.com/tutorials/series/disaster-emergency-response-gis/)

## Key takeaways

1.  A flash flood drains fast. The first Sentinel-1 pass available on the Planetary Computer came 64 hours after the rain began, by when most streets in L'Horta Sud were dry again.
2.  Sentinel-1 change detection was almost never wrong where it said 'flood' (precision 0.99 against Copernicus EMS) but found only 19% of the EMS flood footprint (F1 0.31): it saw standing water in the rice fields and the Turia new channel, and 0.5% of the flood traces in the towns.
3.  Adding Sentinel-2 from 31 October, 44 hours after the event, with MNDWI for water and a red/SWIR1 index for fresh mud, raised recall to 0.48 and F1 to 0.53 (IoU 0.36), at the cost of precision (0.59).
4.  Score a flood map with a confusion matrix in square kilometres and report F1 or IoU; overall accuracy (0.76 here) looks flattering because most of the domain is dry land that both maps agree on.

## Before you start

-   Comfortable with NumPy, rasterio and GeoPandas; the Sentinel-1 Pakistan floods tutorial covers decibels, speckle and Otsu thresholds in more depth
-   Python 3.10+ with pystac-client, planetary-computer, rasterio, numpy, scipy, scikit-image, pandas, geopandas, matplotlib and requests
-   An internet connection: imagery streams from the Microsoft Planetary Computer with no account or key, and the first run downloads about 40 MB of Copernicus EMS vectors

**Short answer:** to map a flood from satellites in Python, find the first Sentinel-1 radar pass after the event and a pass from before it on the same orbit, threshold the VV backscatter in decibels with Otsu’s method, and keep only pixels that turned dark. Then add a clear post-event Sentinel-2 image: MNDWI above zero for water and a jump in a red/SWIR1 index for fresh mud. Finally, rasterise an independent reference, such as the Copernicus EMS delineation, and count true and false positives in square kilometres to get precision, recall, F1 and IoU. For the Valencia flash flood, radar alone scored F1 0.31 and radar plus optical scored F1 0.53.

This is Part 2 of **[GIS for disaster emergency response](https://www.technicalgis.com/tutorials/series/disaster-emergency-response-gis/)**. In [Part 1](https://www.technicalgis.com/tutorials/rapid-situational-mapping-open-data-python/) we built a first-hours situation map from open data. Here we map the flood ourselves and check our map against the official one.

On 29 October 2024 a DANA (a cut-off low) stalled over the Valencia region. Several hundred millimetres of rain fell on the hills west of the city in a few hours. The Poyo ravine and its neighbours burst their banks in the evening and sent a wall of water through Paiporta, Picanya, Massanassa, Catarroja, Sedaví and Alfafar towards the Albufera lagoon. More than 220 people died; the official count kept by the investigating court in Catarroja stands at 232 ([CGPJ](https://www.poderjudicial.es/cgpj/es/Poder-Judicial/Tribunales-Superiores-de-Justicia/TSJ-Comunidad-Valenciana/Oficina-de-Comunicacion/Notas-de-prensa/La-jueza-eleva-a-232-la-cifra-oficial-de-victimas-mortales-causadas-por-la-Dana-de-Valencia)). The Copernicus Emergency Management Service was activated the same afternoon as [EMSR773](https://rapidmapping.emergency.copernicus.eu/EMSR773).

A flash flood is the hardest case for satellite mapping. The water came and went within hours to a day, and what remained in the towns was mud, wrecked cars and debris. This tutorial shows what free satellites can and cannot see in that situation, with numbers.

You will learn how to:

1.  download a **Copernicus EMS** delineation and read which image each polygon came from;
2.  find the **earliest post-event Sentinel-1 pass** with STAC, and understand why timing matters so much for a flash flood;
3.  map new water with **Sentinel-1 RTC change detection**, and test the rule on two dry dates;
4.  map water and **fresh sediment** with Sentinel-2 L2A, using the scene’s own cloud mask;
5.  score each map against the EMS reference with an **agreement matrix**, F1 and IoU, and split recall by EMS class.

All outputs below are real results from [`satellite_flood_mapping.py`](https://www.technicalgis.com/code/satellite-flood-mapping-sentinel-1-sentinel-2/), run on 17 November 2026 with Python 3.12.0, pystac-client 0.9.1, rasterio 1.5.2, geopandas 1.2.0 and scikit-image 0.26.0. The full run takes under a minute once the EMS files are cached.

For the basics of radar flood mapping (decibels, speckle, the Lee filter and Otsu’s method) see [Sentinel-1 SAR flood mapping in Python](https://www.technicalgis.com/tutorials/sentinel-1-sar-flood-mapping/). Here we build on it.

## Step 1: download the Copernicus EMS reference

Every Copernicus EMS activation has a public JSON description. It lists the areas of interest (AOIs), the products for each and the images they were made from. The first delineation for AOI01, “Valencia province”, is a shapefile bundle in a zip file. GeoPandas reads it straight from the zip.

`satellite_flood_mapping.py`

```python
EMS_API = "https://rapidmapping.emergency.copernicus.eu/backend/dashboard-api/public-activations/?code=EMSR773"
act = requests.get(EMS_API, timeout=60).json()["results"][0]
aoi1 = next(a for a in act["aois"] if a["number"] == 1)
first = next(p for p in aoi1["products"] if p["type"] == "DEL" and p["monitoringNumber"] == 0)
for img in first["images"]:
    print(f"  {img['sensorName']:<12} {img['acquisitionTime']}  ({img['resolutionClass']})")
zip_path = DATA / Path(first["downloadPath"]).name
if not zip_path.exists():
    zip_path.write_bytes(requests.get(first["downloadPath"], timeout=300).content)

def ems_layer(name: str) -> gpd.GeoDataFrame:
    return gpd.read_file(f"zip://{zip_path.resolve()}!{stem}_{name}_v1.shp").to_crs(CRS)

ems = ems_layer("observedEventA")          # observed flood polygons
ems_aoi = ems_layer("areaOfInterestA")     # the area EMS actually mapped
sources = gpd.read_file(DATA / "source.dbf").set_index("src_id")
ems["source"] = ems.dmg_src_id.map(lambda i: f"{sources.source_nam[i]} {sources.src_date[i]}")
```

The `notation` field says whether a polygon is **Flooded area** (water still visible) or **Flood trace** (dried out, but mud and debris show it was flooded). The `dmg_src_id` field links each polygon to the image it was drawn from.

`Output — Copernicus EMS activation EMSR773`

```text
EMSR773: Flood in Valencia Region, Spain | event 2024-10-29T14:30:00 UTC | activated 2024-10-29T16:40:00 UTC
AOI 01 Valencia province: first delineation, delivered 2024-11-02T03:02
  Sentinel-2   2024-10-31T10:51:00  (HR+)
  Landsat-8    2024-10-30T10:37:00  (HR+)
  Sentinel-1   2024-10-31T18:02:00  (HR+)
study area 22.1 x 19.5 km; EMS observed flood inside it:
notation      source
Flood trace   Landsat-8 30/10/2024     63.5
Flooded area  Sentinel-1 31/10/2024     0.6
              Sentinel-2 31/10/2024    34.7
```

This table already tells the story. Inside our 22 × 20 km study area, almost two thirds of the EMS footprint, 63.5 km², is **flood trace** drawn from Landsat-8 the morning after. Only 35 km² was still visibly wet two days later, and that is mostly the rice fields around the Albufera. EMS analysts mapped the towns from mud, not water. Our satellites will have to do the same, or miss them.

![Map of L'Horta Sud over a true-colour Sentinel-2 image from 26 October 2024. Orange flood-trace polygons cover a broad band from the farmland west of Aldaia, north of Torrent, through Picanya, Paiporta, Sedaví, Massanassa and Catarroja. Blue flooded-area polygons cover the rice fields north of the Albufera lagoon and the Turia new channel.](https://www.technicalgis.com/_astro/01-ems-reference.DzmggFWj_10LUEs.webp)

_The Copernicus EMS first delineation for EMSR773 inside the study area: 35 km² of flooded area (blue) and 64 km² of flood trace (orange), drawn over the Sentinel-2 image of 26 October, three days before the flood._

## Step 2: find the earliest Sentinel-1 pass after the event

Sentinel-1 sees through cloud, so it should be the first satellite to map a flood. But it only passes over a given place every few days, and in October 2024 only Sentinel-1A was operating. We search the Planetary Computer’s `sentinel-1-rtc` collection for October and early November.

`satellite_flood_mapping.py`

```python
catalog = pystac_client.Client.open(STAC_URL, modifier=planetary_computer.sign_inplace)
s1_items = list(catalog.search(collections=["sentinel-1-rtc"], bbox=BBOX,
                               datetime="2024-10-01/2024-11-10").items())
passes = pd.DataFrame([{"date": i.datetime.strftime("%Y-%m-%d"), "time_utc": i.datetime.strftime("%H:%M"),
                        "orbit": i.properties["sat:relative_orbit"], "direction": i.properties["sat:orbit_state"]}
                       for i in s1_items]).drop_duplicates().sort_values(["date", "time_utc"])
```

`Output — Sentinel-1 RTC passes over the study area`

```text
      date time_utc  orbit  direction
2024-10-01    06:10      8 descending
2024-10-02    17:55     30  ascending
2024-10-07    18:03    103  ascending
2024-10-08    06:02    110 descending
2024-10-13    06:10      8 descending
2024-10-14    17:55     30  ascending
2024-10-19    18:03    103  ascending
2024-10-20    06:02    110 descending
2024-10-25    06:10      8 descending
2024-10-26    17:55     30  ascending
2024-11-01    06:02    110 descending
2024-11-06    06:10      8 descending
2024-11-07    17:55     30  ascending
first pass after the event: 2024-11-01 06:02 UTC, 64 hours after the rain began
```

Look at orbit 103. It passed on 7 and 19 October, so it should have passed again on 31 October at 18:02, and that is the Sentinel-1 scene EMS used. It is not in the Planetary Computer catalogue, so the first pass we can use is **1 November at 06:02 UTC on descending orbit 110**, about 64 hours after the rain began. A pass on 20 October from the same orbit gives a clean “before” image, with the same viewing geometry. We also read 8 October as a control date, before any rain.

## Step 3: read Sentinel-1 onto one 10 m grid

Each Sentinel-1 date over Valencia is split across two frames, so we mosaic them. We stream each frame through a `WarpedVRT` onto a fixed 10 m grid in ETRS89 / UTM zone 30N (EPSG:25830), apply a Lee filter to the linear power, and convert to decibels. The filter’s equivalent number of looks comes from the STAC item rather than a guess.

`satellite_flood_mapping.py`

```python
ENL = post_item.properties["sar:looks_equivalent_number"]

def read_s1_db(date: str, pol: str = "vv") -> np.ndarray:
    """Mosaic every frame of one orbit on one date, Lee-filter in linear power, return dB."""
    frames = [i for i in s1_items if i.datetime.strftime("%Y-%m-%d") == date
              and i.properties["sat:relative_orbit"] == S1_ORBIT]
    power = np.full((HEIGHT, WIDTH), np.nan, "float32")
    for it in frames:
        arr = warp(it.assets[pol].href)
        power = np.where(np.isfinite(power), power, arr)
    return 10 * np.log10(lee_filter(power))

vv = {d: read_s1_db(d) for d in (S1_CONTROL, S1_PRE, S1_POST)}
```

`Output — reading Sentinel-1 VV (orbit 110, descending, 10 m)`

```text
2024-10-08: 100.0% valid, median -9.1 dB
2024-10-20: 100.0% valid, median -9.4 dB
2024-11-01: 100.0% valid, median -8.4 dB
```

The whole study area is covered on all three dates. The median brightens slightly after the flood, which is what wet soil does: water in the soil raises its dielectric constant and it reflects more radar energy.

## Step 4: map new water by change detection

A pixel is new water if it is below the water threshold after the event, was above it before, and has darkened by at least 3 dB. The extra 3 dB rule stops pixels that sit just either side of the threshold from flickering in and out. We clean the result with a morphological opening and drop patches smaller than 0.2 hectares.

`satellite_flood_mapping.py`

```python
pre, post = vv[S1_PRE], vv[S1_POST]
s1_valid = np.isfinite(pre) & np.isfinite(post)
thr = threshold_otsu(post[s1_valid])
DROP = -3.0

def s1_flood(before, after):
    return clean((after < thr) & (before >= thr) & (after - before < DROP))

s1_water_pre = clean(pre < thr)
s1 = s1_flood(pre, post) & s1_valid
control = s1_flood(vv[S1_CONTROL], pre) & s1_valid   # the same rule on two dry dates
```

`Output — Sentinel-1 change detection`

```text
Otsu threshold on 2024-11-01: -12.3 dB; change rule: below it, above it before, and -3 dB darker
water on 2024-10-20: 76.2 km²
new water on 2024-11-01: 24.2 km²
same rule on two dry dates (2024-10-08 -> 2024-10-20): 4.37 km² flagged
```

The control is the useful number here. Run between two dry dates, the same rule flags 4.37 km²: that is our false-alarm floor, from speckle, ploughing and changing crops. The flood pass flags 24.2 km², more than five times as much. Of that, 14.7 km² lies outside permanent water and is scored in Step 6.

![Three radar panels of the study area. The before image of 20 October and the after image of 1 November look similar in the city and the towns, but on 1 November the rice fields north of the Albufera are black. The change panel is mostly pale, with a solid dark-red block over the rice fields and a thin dark-red line along the Turia new channel south of València.](https://www.technicalgis.com/_astro/02-sentinel-1-change.CpGaXpUq_HyzVc.webp)

_Sentinel-1 VV before (20 October) and after (1 November, 06:02 UTC), and the change between them. Red is darker after. The rice fields north of the Albufera and the Turia new channel are still under water; the flooded towns of L'Horta Sud show almost no change._

![Two histograms. Left: VV backscatter before and after the flood, each with a small water mode between −22 and −17 dB and a large land peak near −9 dB; the Otsu threshold is marked at −12.3 dB, on the lower flank of the land peak. Right: the change in VV on a log scale; the two dry dates form a single peak around zero, while the flood pair has a second hump between −12 and −8 dB, beyond the −3 dB rule.](https://www.technicalgis.com/_astro/03-sentinel-1-threshold.DIQpPLGX_Z2fmbbq.webp)

_Left: the Otsu threshold of −12.3 dB on the post-event image. Right: change between passes on a log scale. The flood pair has a second mode of strong darkening, around −10 dB, that the two dry dates do not have: that is the standing floodwater._

The histogram on the left shows why the threshold, −12.3 dB, is higher than the −15 to −18 dB often quoted for open water. The land peak holds far more pixels than the water mode (the sea, the lagoon and the flooded paddies), so Otsu’s split sits on the lower flank of the land peak rather than in the middle of the valley. Some dark fields fall below it, which is why the change rule and the dry-date control matter. On the right, the flood is easy to see: a second hump of pixels that darkened by about 10 dB.

## Step 5: add Sentinel-2 water and fresh sediment

Sentinel-2 cannot see through cloud, but it can see mud. Tile 30SYJ was imaged on 26 October (before) and 31 October at 10:51 UTC, 44 hours after the event. The western part of the 31 October scene is under cumulus, and the east has haze. We read five bands at 10 m and the scene classification layer (SCL), and we mask cloud, cloud shadow and saturated pixels on both dates.

`satellite_flood_mapping.py`

```python
def read_s2(item) -> dict:
    """Surface reflectance (0-1) at 10 m. Baseline 04.00+ scenes carry a +1000 offset."""
    offset = 1000 if float(item.properties["s2:processing_baseline"]) >= 4 else 0
    bands = {b: (warp(item.assets[b].href, Resampling.bilinear) - offset) / 10000
             for b in ("B02", "B03", "B04", "B08", "B11")}
    bands["SCL"] = warp(item.assets["SCL"].href, Resampling.nearest, "uint8")
    return bands

def mndwi(b):
    return (b["B03"] - b["B11"]) / (b["B03"] + b["B11"])

def sediment(b):
    """Normalised difference of red and SWIR1: wet, fresh mud is bright in red and dark in SWIR1."""
    return (b["B04"] - b["B11"]) / (b["B04"] + b["B11"])

s2_clear = ~np.isin(s2[S2_POST]["SCL"], S2_CLOUD) & ~np.isin(s2[S2_PRE]["SCL"], S2_CLOUD)
permanent = (mndwi(s2[S2_PRE]) > 0) | (s2[S2_PRE]["SCL"] == 6) | s1_water_pre
s2_water = clean((mndwi(s2[S2_POST]) > 0) & ~permanent) & s2_clear
d_sed = sediment(s2[S2_POST]) - sediment(s2[S2_PRE])
s2_sed = clean((d_sed > 0.2) & ~s2_water & ~permanent) & s2_clear
```

The sediment index is simple. Fresh, wet mud from the ravines is reddish-brown and still holds water, so it is bright in red and dark in shortwave infrared. A rise of more than 0.2 in the red/SWIR1 normalised difference since 26 October marks ground that has been covered with it. Permanent water combines three sources (the pre-event MNDWI, the SCL water class and the pre-event radar water) so that the sea, the port, the lagoon and the river are left out of every score.

`Output — Sentinel-2 L2A`

```text
2024-10-26 30SYJ 10:51 UTC | tile cloud 21% | baseline 05.11
2024-10-31 30SYJ 10:51 UTC | tile cloud 56% | baseline 05.11
post-event scene: 44 hours after the rain began
clear on both dates (SCL): 56.8% of the study area
permanent water (sea, port, Albufera, river): 94.4 km²
new water, MNDWI > 0: 11.2 km²
fresh sediment, red/SWIR1 index up by > 0.2: 28.8 km²
```

Only 56.8% of the study area is clear on both dates. Any score that uses Sentinel-2 must be computed on those pixels only, otherwise cloud would count as “not flooded”.

![Two panels. Left: a true-colour Sentinel-2 image of 31 October 2024 with white cumulus over the west and haze over the rice fields; the Turia new channel is full of brown water and a brown plume spreads into the sea. Right: the same area in grey with masks: white for cloud, blue for new water in the rice fields north of the Albufera and a stretch of the Turia new channel, brown patches of fresh sediment scattered across the farmland and town edges, and pale blue-grey for permanent water.](https://www.technicalgis.com/_astro/04-sentinel-2-water-sediment.Dc6Kg2lp_LrRuQ.webp)

_Sentinel-2 on 31 October, 44 hours after the event, and the masks derived from it: new water (MNDWI > 0), fresh sediment (red/SWIR1 index up by more than 0.2) and cloud masked by the SCL layer._

## Step 6: score the maps against Copernicus EMS

Now the honest part. We rasterise the EMS polygons (flooded area plus flood trace) onto the same grid and compare pixel by pixel. The evaluation domain is the EMS area of interest, minus permanent water, minus pixels without radar. The Sentinel-2 methods are scored only where Sentinel-2 was clear on both dates. We count each cell of the confusion matrix in square kilometres.

`satellite_flood_mapping.py`

```python
domain = in_aoi & s1_valid & ~permanent
combined = s1 | s2_water | s2_sed

def agreement(pred, ref, where) -> dict:
    tp = km2(pred & ref & where)
    fp = km2(pred & ~ref & where)
    fn = km2(~pred & ref & where)
    tn = km2(~pred & ~ref & where)
    return {"domain_km2": tp + fp + fn + tn, "ours_km2": tp + fp, "ems_km2": tp + fn, "TP": tp, "FP": fp, "FN": fn,
            "TN": tn, "precision": tp / (tp + fp), "recall": tp / (tp + fn), "F1": 2 * tp / (2 * tp + fp + fn),
            "IoU": tp / (tp + fp + fn), "overall": (tp + tn) / (tp + fp + fn + tn)}

methods = {
    "S1 change, all pixels": (s1, domain),
    "S1 change, S2-clear pixels": (s1, domain & s2_clear),
    "S2 water (MNDWI)": (s2_water, domain & s2_clear),
    "S2 water + sediment": (s2_water | s2_sed, domain & s2_clear),
    "S1 + S2 combined": (combined, domain & s2_clear),
}
metrics = pd.DataFrame({k: agreement(p, ems_any, w) for k, (p, w) in methods.items()}).T
```

`Output — agreement with EMSR773 (flooded area + flood trace), km² and scores`

```text
                            domain_km2  ours_km2  ems_km2    TP    FP    FN
S1 change, all pixels            335.8      14.7     78.9  14.6   0.1  64.3
S1 change, S2-clear pixels       182.3       9.1     50.0   9.1   0.1  40.9
S2 water (MNDWI)                 182.3      11.2     50.0  11.0   0.2  39.0
S2 water + sediment              182.3      40.0     50.0  23.3  16.8  26.7
S1 + S2 combined                 182.3      40.6     50.0  23.8  16.8  26.2
                            precision  recall     F1    IoU  overall
S1 change, all pixels           0.991   0.185  0.311  0.184    0.808
S1 change, S2-clear pixels      0.994   0.182  0.307  0.182    0.775
S2 water (MNDWI)                0.984   0.220  0.360  0.219    0.785
S2 water + sediment             0.581   0.465  0.517  0.348    0.761
S1 + S2 combined                0.586   0.476  0.526  0.357    0.764
```

Read it row by row:

-   **Sentinel-1 alone** is precise and incomplete. Of 14.7 km² it mapped, 14.6 km² is inside the EMS footprint (precision 0.99). But it found only 18.5% of the 78.9 km² EMS mapped, so F1 is 0.31 and IoU 0.18.
-   **Sentinel-2 water** behaves the same way: precision 0.98, recall 0.22. Water is water, whichever sensor sees it.
-   **Adding sediment** more than doubles the true positives, from 11.0 to 23.3 km², and lifts F1 to 0.52. It also adds 16.6 km² of false positives, so precision falls to 0.58.
-   **Everything combined** gives the best scores: F1 0.53, IoU 0.36.
-   **Overall accuracy** stays between 0.76 and 0.81 whatever we do, because dry land that both maps agree on dominates the domain. Do not report it alone for a flood map.

`Output — confusion matrix, S1 + S2 combined (km², S2-clear pixels)`

```text
                 ours flooded  ours not flooded
EMS flooded              23.8              26.2
EMS not flooded          16.8             115.5
```

### Recall by EMS class

The table above mixes two different things. Splitting recall by the EMS `notation` shows where each method succeeds.

`Output — recall by EMS class (share of EMS pixels we also mapped)`

```text
                            flooded area  flood trace
method
S1 change, all pixels              0.715        0.005
S1 change, S2-clear pixels         0.759        0.002
S2 water (MNDWI)                   0.914        0.004
S2 water + sediment                0.939        0.318
S1 + S2 combined                   0.981        0.319
```

Where EMS saw water, we found it: 72% with radar alone, 98% with both sensors. Where EMS saw only the traces of a flood that had passed, radar found 0.5%, which is no better than chance. The sediment index found 32% of the traces. That is the whole gap between F1 0.31 and F1 0.53.

### A second reference: the very-high-resolution map of Horta Sud

EMS also mapped AOI03, Horta Sud, from WorldView-2 (0.5 m) and GeoEye-1 (2 m) images taken on 31 October. That is an independent check on the towns themselves.

`Output — check against the AOI03 Horta Sud delineation (WorldView-2/GeoEye-1, 31 Oct)`

```text
VHR-mapped flood inside the study area: 16.8 km² (11.1 km² on S2-clear pixels)
share caught: S1 1.0%, S1 + S2 combined 34.4% (S2-clear pixels)
```

The same pattern: radar caught 1% of the flood mapped from half-metre imagery in the towns, and the combined map caught 34%.

![Agreement map over a grey radar background. Green, where both maps agree, fills the rice fields north of the Albufera and lines the Turia new channel. Purple, flood that only EMS mapped, covers a large area through Picanya, Paiporta and west of Aldaia and Torrent; a lighter purple marks EMS flood under cloud on 31 October around Sedaví and Catarroja. Orange speckles of satellite-only flood are scattered across the farmland to the south-west and north of València.](https://www.technicalgis.com/_astro/05-agreement-map.imuGkqLS_KqUQu.webp)

_Agreement between the combined satellite map and the EMSR773 delineation. Green: both. Orange: our map only (commission). Purple: EMS only (omission); light purple where Sentinel-2 was cloudy on 31 October, so only radar was scored. F1 0.53 and IoU 0.36 on the Sentinel-2-clear pixels._

The map makes the numbers concrete. The green band through the rice fields is where the methods agree. The large purple area through Picanya, Paiporta and the farmland west of Aldaia is flood trace that EMS drew from Landsat-8 on 30 October and that no index of ours picked up. The orange speckles in the south-west are mostly irrigated orchards and fields whose red/SWIR1 ratio changed for other reasons, including haze on 31 October. Notice too what is missing: the whole flood path from the Poyo ravine through Paiporta to Catarroja is almost free of green.

![Three two-by-two confusion matrices in square kilometres and a bar chart. Sentinel-1 change: 9.1 true positives, 40.9 false negatives, 0.1 false positives, F1 0.31. Sentinel-2 water plus sediment: 23.3, 26.7, 16.8, F1 0.52. Combined: 23.8, 26.2, 16.8, F1 0.53. The bars show recall on EMS flooded area near 76 to 98 per cent for all three methods, and on flood trace near zero for Sentinel-1 and about 32 per cent for the other two.](https://www.technicalgis.com/_astro/06-agreement-matrix.C0QvTgrg_Z2fjjHQ.webp)

_Agreement matrices on the Sentinel-2-clear pixels (rows: EMS; columns: our map) and recall split by EMS class. Every method finds the standing water. Only the sediment index finds any of the flood traces._

## Step 7: save the flood map

The script writes the result as a single-band GeoTIFF with one class per source, and as polygons in a GeoPackage, so it can go straight into the next steps of the response. Where the sources overlap, radar water takes priority, then Sentinel-2 water, then sediment, which is why the GeoPackage holds less Sentinel-2 water than the Step 5 total.

`satellite_flood_mapping.py`

```python
classes = np.zeros((HEIGHT, WIDTH), "uint8")
classes[s2_sed] = 3
classes[s2_water] = 2
classes[s1] = 1
classes[~domain] = 255
# ... write flood_valencia_2024.tif, then vectorise with rasterio.features.shapes
polys.to_file(OUT / "flood_valencia_2024.gpkg", driver="GPKG")
```

`Output — saved`

```text
6,314 polygons: S1 water 2024-11-01 14.7 km², S2 sediment 2024-10-31 28.8 km², S2 water 2024-10-31 2.7 km²
```

The script also writes `metrics.json` with every score, so you can track agreement as you change thresholds.

## What this means for responders

Two days after a flash flood, free satellite imagery is reliable for **where water is still standing**: precision was 0.98 to 0.99 for both sensors. That matters for pumping, access and the rice fields. It is not reliable for **where the flood went**. For that, the Copernicus EMS products, which combine every available image and analyst judgement, were far more complete than any automatic method here. Use your own map to fill gaps and to update between EMS deliveries, and use the agreement matrix to tell users how far to trust it.

## Limitations and how to improve them

-   **Timing beats method.** The 31 October Sentinel-1 scene used by EMS is not on the Planetary Computer; download the GRD from the [Copernicus Data Space Ecosystem](https://www.technicalgis.com/data-sources/#src-copernicus-data-space-ecosystem) and process it to RTC to gain 12 hours.
-   **The reference is not ground truth.** EMS flood trace was drawn largely from 30 m Landsat-8, so its edges are coarser than our 10 m pixels.
-   **The rice paddies are flooded on purpose** in autumn and winter, so some of the radar darkening around the Albufera may be farming rather than the storm.
-   **The sediment index is crude.** Haze on 31 October and harvested fields cause false positives; a pre/post texture measure or a classifier trained on the AOI03 polygons would do better.
-   **Flooded streets look bright in radar**, not dark, because of double bounce off walls. A backscatter-increase rule, like the amplitude change used in [earthquake damage mapping with Sentinel-1](https://www.technicalgis.com/tutorials/earthquake-damage-mapping-sentinel-1-python/), is worth testing in the towns.
-   **Terrain context helps.** A height above nearest drainage mask, as in [HAND flood mapping in Python](https://www.technicalgis.com/tutorials/height-above-nearest-drainage-python/), would remove most commission on higher ground.

## Frequently asked questions

### Why did Sentinel-1 miss most of the Valencia flood?

Because the water had gone. The first Sentinel-1 pass on the Planetary Computer was on 1 November at 06:02 UTC, 64 hours after the rain began. By then the towns of L’Horta Sud had drained and were covered in mud and debris, which does not look dark to radar. Sentinel-1 still found 72% of the area that Copernicus EMS mapped as standing water, with precision 0.99.

### Can Sentinel-2 map flood mud and debris?

Partly. A rise in the normalised difference of red and SWIR1 between a pre-event and post-event scene marks fresh, wet mud. Here it found 32% of the EMS flood traces, against 0.5% for radar, but it also added 16.8 km² of false positives in farmland. It works only on cloud-free pixels, which were 56.8% of the study area on 31 October.

### How do I compare my flood map with a Copernicus EMS map?

Download the EMS delineation vectors from the activation page, rasterise the observed event polygons onto your grid, remove permanent water and cloud from the comparison, and count true positives, false positives, false negatives and true negatives. Report precision, recall, F1 and IoU. Split recall by the EMS `notation` field (flooded area or flood trace) to see what kind of flood you are missing.

### What is a good F1 score for a flood map?

There is no fixed bar; it depends on the event, the reference and the time between them. Against standing water alone, our methods were near-perfect here (precision 0.98 to 0.99, recall of EMS flooded area up to 0.98). Against a footprint that is mostly dried flood trace, F1 0.53 was the best we reached two days after a flash flood. Always report the confusion matrix in area units next to the score, and the time gap between your image and the reference.

### Is Copernicus EMS data free to use?

Yes. Copernicus EMS products are free, full and open, under the Copernicus data policy (Regulation (EU) 2021/696), with ownership credited as © European Union, Copernicus Emergency Management Service. See the service’s [terms and conditions](https://mapping.emergency.copernicus.eu/terms-and-conditions/).

## Next steps

-   Go back to [Part 1, rapid situational mapping from open data](https://www.technicalgis.com/tutorials/rapid-situational-mapping-open-data-python/), and add this flood layer to the situation map.
-   Part 3 of the series uses a flood extent like this one to count the buildings and people exposed, and Part 4 removes flooded roads from the network to test access to hospitals.
-   Revisit the radar basics in [Sentinel-1 SAR flood mapping in Python](https://www.technicalgis.com/tutorials/sentinel-1-sar-flood-mapping/), and compare speckle filters in [SAR speckle filtering in Python](https://www.technicalgis.com/tutorials/sar-speckle-filter-python/).
-   Learn the Sentinel-2 STAC workflow and water indices in [Measuring Lake Mead’s shrinking shoreline with Sentinel-2 and STAC](https://www.technicalgis.com/tutorials/sentinel-2-stac-lake-mead/), and improve the cloud mask with [Sentinel-2 cloud masking in Python](https://www.technicalgis.com/tutorials/sentinel-2-cloud-masking-python/).
-   Add terrain with [height above nearest drainage (HAND) flood mapping in Python](https://www.technicalgis.com/tutorials/height-above-nearest-drainage-python/).
-   Learn more ways to score a map in [land cover accuracy assessment in Python](https://www.technicalgis.com/tutorials/land-cover-accuracy-assessment-python/).

## Data and licences

-   **Copernicus EMS Rapid Mapping, activation EMSR773** (AOI01 and AOI03 delineation products): © European Union, Copernicus Emergency Management Service. Free, full and open access under the Copernicus data policy; see the [terms and conditions](https://mapping.emergency.copernicus.eu/terms-and-conditions/). Downloaded from the [activation page](https://rapidmapping.emergency.copernicus.eu/EMSR773) on 17 November 2026.
-   **Sentinel-1 RTC**: contains modified Copernicus Sentinel data 2024, processed by ESA; radiometric terrain correction by Catalyst/Microsoft. Licensed CC BY 4.0. Accessed from the [Microsoft Planetary Computer](https://planetarycomputer.microsoft.com/dataset/sentinel-1-rtc) on 17 November 2026.
-   **Sentinel-2 Level-2A**: contains modified Copernicus Sentinel data 2024, free and open under the [Copernicus Sentinel data terms](https://sentinels.copernicus.eu/documents/247904/690755/Sentinel_Data_Legal_Notice). Accessed from the [Microsoft Planetary Computer](https://planetarycomputer.microsoft.com/dataset/sentinel-2-l2a) on 17 November 2026.
-   Death toll: Consejo General del Poder Judicial, press release of the Catarroja investigating court ([CGPJ](https://www.poderjudicial.es/cgpj/es/Poder-Judicial/Tribunales-Superiores-de-Justicia/TSJ-Comunidad-Valenciana/Oficina-de-Comunicacion/Notas-de-prensa/La-jueza-eleva-a-232-la-cifra-oficial-de-victimas-mortales-causadas-por-la-Dana-de-Valencia)), accessed 17 November 2026.
-   References: Xu, H. (2006), “Modification of normalised difference water index (NDWI) to enhance open water features in remotely sensed imagery”, _International Journal of Remote Sensing_ 27(14); Lee, J.-S. (1980), _IEEE Transactions on Pattern Analysis and Machine Intelligence_ 2(2); Otsu, N. (1979), _IEEE Transactions on Systems, Man, and Cybernetics_ 9(1).
-   Code: [`satellite_flood_mapping.py`](https://www.technicalgis.com/code/satellite-flood-mapping-sentinel-1-sentinel-2/), tested with Python 3.12.0, pystac-client 0.9.1, planetary-computer 1.0.0, rasterio 1.5.2, geopandas 1.2.0, numpy 2.5.5 and scikit-image 0.26.0.

## Key terms

- **DANA**: Depresión aislada en niveles altos: an isolated upper-level low (a 'cut-off low') that can stall over warm Mediterranean water and release extreme rain.
- **Copernicus EMS Rapid Mapping**: The European Union's on-demand emergency mapping service. After an activation it delivers flood delineation and damage grading maps, usually within hours to days.
- **Flood trace**: An EMS class for ground that was flooded but has dried out by the time of the image, recognised from mud, debris and damaged vegetation.
- **MNDWI**: Modified normalised difference water index, (green − SWIR1) / (green + SWIR1). Open water is usually above zero.
- **F1 and IoU**: Agreement scores for a mapped class. F1 = 2TP / (2TP + FP + FN); IoU (intersection over union) = TP / (TP + FP + FN). Both ignore the true negatives.

## Data for this tutorial

-   [Microsoft Planetary Computer](https://www.technicalgis.com/data-sources/#src-microsoft-planetary-computer) · Sentinel-1 RTC and Sentinel-2 L2A as Cloud Optimised GeoTIFFs via STAC
-   [Copernicus EMS rapid mapping](https://www.technicalgis.com/data-sources/#src-copernicus-ems-mapping) · Activation EMSR773 delineation vectors, used as the reference
-   [Copernicus Data Space Ecosystem](https://www.technicalgis.com/data-sources/#src-copernicus-data-space-ecosystem) · Sentinel-1 GRD scenes not mirrored on the Planetary Computer

Licences and formats for each source are listed in the [GIS data sources catalogue](https://www.technicalgis.com/data-sources/).

[← Part 1 Rapid situational mapping from open data in Python: the Valencia floods of 29 October 2024](https://www.technicalgis.com/tutorials/rapid-situational-mapping-open-data-python/)

---

Source: https://www.technicalgis.com/tutorials/satellite-flood-mapping-sentinel-1-sentinel-2/
