Skip to content

Methodology

How AquaLens reads water from space.

Two parts work in turn. A deterministic core takes a Sentinel-2 image of the area, finds the water in it, measures chlorophyll, turbidity and plants on the water, and turns them into a 0–100 score. The same image always gives the same score, and it is unit-tested. Then five Gemini agents add context and write the brief and the public summary. They never change the score. Every step is recorded.

In short

  1. 1 Find the newest satellite photo that sees the water clearly.
  2. 2 Find the water in it, leaving out land, cloud and the shoreline.
  3. 3 Read its colour: green means algae, brown means mud, leaves mean plants.
  4. 4 Place the algae on the WHO alert levels: Low, Medium or High, as a 0–100 score.
  5. 5 AI agents add history and write the summary; they cannot change the result.

The image

AquaLens searches the Microsoft Planetary Computer for sentinel-2-l2a scenes that cover the area within the chosen dates and have under 30% cloud over the whole scene (you can change the limit). A scene is about 110 km across, so its cloud figure says little about one lake: AquaLens reads the scene's own cloud map (the SCL band) over the area and takes the newest scene with a clear view of it. When every scene is cloud over the area, there is no score, and the page says so.

Pixels the SCL marks as cloud, cloud shadow or thin cirrus (classes 3, 8, 9, 10) are removed. How much of the water that leaves is reported as confidence, not added to the score. Bands B02, B03, B04, B05, B08 and B11 are read as Cloud-Optimized GeoTIFFs, clipped to the area, with the 20 m bands aligned to the 10 m grid.

The monthly trend on a water body's page works differently: for each month it takes the scene with the least cloud that sees the water.

Finding the water

A pixel is water when NDWI > 0 and MNDWI > 0. Each test alone mistakes some land for water (NDWI some roofs and shadow, MNDWI some bright soils); together they keep open water. A water pixel next to land mixes both, which reads as extra chlorophyll at every shore, so those pixels are left out unless fewer than 50 would remain (a river reach or a small pond). Each index is then the median over the scored pixels, which a few glinting or mixed pixels cannot move. A pixel where one of an index's bands reads at or below zero (very dark water, under the sensor's floor) is left out of that index, because the ratio there is exactly +1 or −1 whatever the water holds.

Fewer than 50 scored water pixels (0.5 ha) is too little to score: the assessment says so, and no alert or sampling advice is based on it.

The six indices

Each is a normalised ratio of two or more bands, computed per pixel. Three enter the score; two decide where the water is; one is shown for reference.

Normalized Difference Water Index

NDWI

Water test · B03 · B08 · McFeeters (1996)

(Green − NIR) / (Green + NIR)

Where the water is: water reflects more green than near-infrared light. Half of the water test.

Modified NDWI

MNDWI

Water test · B03 · B11 · Xu (2006)

(Green − SWIR) / (Green + SWIR)

Where the water is, using short-wave infrared, so roofs and roads are not taken for water. The other half of the water test.

Normalized Difference Chlorophyll Index

NDCI

In the score · B05 · B04 · Mishra & Mishra (2012)

(Red edge − Red) / (Red edge + Red)

Chlorophyll-a, the sign of algae. Converted to µg/L and placed on the WHO alert levels.

Normalized Difference Turbidity Index

NDTI

In the score · B04 · B03 · Lacaux et al. (2007)

(Red − Green) / (Red + Green)

Turbidity: murky water reflects more red, often from suspended sediment.

Normalized Difference Vegetation Index

NDVI

In the score · B08 · B04 · Rouse et al. (1974)

(NIR − Red) / (NIR + Red)

Plants on the water: floating biomass or weed growing into the lake, read over the water only.

Water Ratio Index

WRI

Shown only · B03 · B04 · B08 · B11

(Green + Red) / (NIR + SWIR)

A further water signal, shown for reference; above about 2.5 usually means open water. Not in the score.

The score

The score is the larger of two readings of the same water, so either can raise it and neither can hide the other.

1. Chlorophyll on the WHO alert levels

Chlorophyll-a is estimated from NDCI with Mishra & Mishra (2012):

Chl-a (µg/L) = 14.039 + 86.115·NDCI + 194.325·NDCI²

It is placed on the WHO (2021) recreational alert levels: 12 µg/L (alert level 1) is where medium starts, 24 µg/L (alert level 2) where high starts, and 48 µg/L the top of the scale. This is the part a laboratory can check; the Verified page shows how it compares with lab samples.

2. Weighted indices

Each index is scaled from 0 to 1 across its range, then weighted. Turbidity or plants can raise the score above the chlorophyll reading; they never lower it.

NDCI (chlorophyll-a)
0.533 · range -0.1 to 0.5
NDTI (turbidity)
0.333 · range -0.2 to 0.6
NDVI over the water (plants)
0.133 · range 0 to 0.6

Verified field observations (from the operator or an organisation's API key) add up to 50 points. On a public service, anonymous ones are kept but do not move the score until the operator confirms them. The result is clamped to 0–100. Below 33 is low, below 66 medium, the rest high. Urgency follows the level and the latest observation: algae seen, 5 or more dead fish or 3 or more complaints raise it.

Confidence

Confidence says how well the satellite saw the water. It never changes the score. It starts at high and drops one step for each of: more than 30% of the area under cloud; short-wave infrared over the water above 0.03 (sun glint, haze or a surface film); only shoreline pixels to score; and a 90% interval on the score wider than 10 points (from resampling the pixels). One problem gives medium, two or more low.

That pixel interval is narrow because neighbouring pixels are alike. Lab tests are the real check: on 174 lab samples from western Lake Erie, the algae part of the score was within 24 points of the lab on 64% of them and read 11 points low on average, so each result shows that figure as its lab-checked accuracy. The level says where to sample first; it is not a lab result.

What the agents may do

Once the score is set, five Gemini agents take the result: they choose which specialists run, name the place, add history and local reporting, and write the brief and the public summary. Each works under a written brief and a structured output that forbids overclaiming. None can change the score, level or urgency.

Every step is kept in the assessment's trace (Agent decisions). When an agent fails, the failure stays in the trace and a deterministic text takes its place, so every assessment still has a brief and a summary.

How it works

Two pipelines. One session trace.

The deterministic numeric core runs first and produces the auditable numbers. The Gemini agent layer wraps it: agents choose inputs and write prose, but they can't move the risk band. Every decision lands in the per-session trace.

Deterministic coreGemini agent

Pipeline 1 · deterministic core

Source of truth for the numbers
  1. Step 01

    Pick an area

    search, paste coordinates, or tap the map

    Tap a lake and AquaLens outlines it from the JRC Global Surface Water map, or uses a square around the point. A water check classifies the area as water, mixed, or land.

  2. Step 02

    Fetch Sentinel-2 imagery

    Microsoft Planetary Computer · STAC query

    The backend searches the Sentinel-2 L2A archive for scenes over the area under the cloud limit, reads each one's cloud map over the area, and takes the newest with a clear view of the water. It reads only the bands it needs.

  3. Step 03

    Compute spectral indices

    deterministic numpy + audit-friendly weights

    NDWI and MNDWI find the water; shore pixels are left out. Six indices (NDWI · MNDWI · NDTI · NDCI · NDVI · WRI) are taken as medians over the water, with the scene and pixel count recorded for each.

  4. Step 04

    Score the risk

    WHO chlorophyll levels, unit-tested, reproducible

    Chlorophyll-a on the WHO alert levels, or the weighted chlorophyll, turbidity and plant indices if higher, gives a 0–100 score, a level (low / medium / high) and an urgency. The agents can never move these numbers.

Pipeline 2 · Gemini agent layer

Agents choose inputs & write prose
  1. Agent 1

    Gemini

    Coordinator · plans the workflow

    Gemini thinking mode

    Looks at the water body and whether it has history or field evidence, then decides which specialists run: Scout, Analyst and Reporter always, Historian only when there is history. A repeat of the same situation reuses the plan from a cache.

  2. Agent 2

    Gemini

    Scout · confirms the scene and names the place

    Google Search grounding

    Records the scene the deterministic pipeline chose. When the spot on the map has no name, it asks Gemini, grounded in Google Search, to identify the lake.

  3. Agent 3

    Gemini

    Historian · adds trends and context

    Search grounding + memory

    Receives earlier assessments with trends and a Mann-Kendall significance test already computed in code, reasons over them, cites local reporting through Google Search grounding and URL Context when available, and writes a short note to the lake's memory for next time.

  4. Agent 4

    Gemini

    Analyst · writes and self-critiques the brief

    Structured output + critique loop

    Drafts recommendation + reasoning + limitations against the deterministic numbers. A separate Gemini call critiques the draft against the hard rules; the Analyst rewrites once if anything fails. Both drafts land in the trace.

  5. Agent 5

    Gemini

    Reporter · writes the citizen summary

    Structured response schema

    Turns the deterministic numbers plus Scout / Historian / Analyst outputs into the public-facing card: likely-safe · use caution · avoid, guidance for adults and for pets and kids, explicit limitations, and citations when grounded context exists. Falls back to a deterministic summary if the Gemini call fails.

Every agent run is captured in the Agentic workflow card on the session page. If any agent fails the orchestrator records the failure and falls back to a deterministic path, so a session always produces a usable brief.