Skip to content

About

Open map that ranks 18,445 coral reefs by whether restoration there will survive the heat

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

24 Commits

Folders and files

Repository files navigation

Coralytics: find coral reefs worth restoring

An open map that ranks 18,445 coral reefs by whether restoration there will survive the heat.

License: MIT Live demo

Live demo · Issues

Coral restoration projects pick sites by logistics and recent damage, not by future heat. Coralytics scores every 5 km reef cell on how often heat bleaches it, how much tougher restored coral must be to hold, and what else stops it recovering. Restoration groups, funders and coral breeding programs can use it to choose sites.

Heron Island in Coralytics: a real 3D reef scan coloured by the model's 2020 heat risk, with 47% of coral left

What it shows

Question Answer in the app Source
Does heat let this reef recover? Bleaching years in the last 10. Two or fewer means it holds. LightGBM model on NOAA Coral Reef Watch daily sea temperature
How much tougher must coral be? Heat tolerance needed, in °C, per reef. A target for breeding programs. The same model, rerun with the reef in cooler water
Will a restored reef last? Local pressure and larvae supply, ranked into "Best places to restore" WCS local reef pressures (Andrello et al. 2022), 50 Reefs connectivity
What does this mean for the reef? A real 3D scan of the nearest surveyed reef, bleaching and dying year by year Open reef scans, CC BY 4.0
What would people lose? Reef tourism a year, people protected from flooding, and neighbours within 50 km TNC Mapping Ocean Wealth, GHS-POP 2020
What about future warming? A switch adds 0.5 °C, about 2040 at today's rate of warming Forster et al. 2025

Evidence

  • Tested on unseen years. The model trained on surveys up to 2013 and was scored on 2016 to 2020. It ranks 30% bleaching at 0.935 AUROC against 0.906 for NOAA's degree heating weeks (2,771 surveys).
  • Tested on new surveys. The model scores 201 MERMAID surveys from 2021 to 2025 in 10 countries at 0.84 AUROC. These surveys came after the training data.
  • Restoration sites ignore heat. The 304 projects in Boström-Einarsson et al. (2020) list why they chose each site. None names heat or bleaching. With 0.5 °C more warming, 66% of the 224 projects near a scored reef sit on reefs too hot for today's coral.
  • Protection matters. In MERMAID surveys, each bleaching year costs 1.9 points of coral cover, and no-take reserves hold 3.2 points more.

Run tools/mermaid_check.py to reproduce the MERMAID numbers.

Note

The yearly bleaching and death in the 3D view is illustrative. It applies 40% mortality to bleached coral and 14% regrowth a year. The bleaching risk itself comes from the model.

Quickstart

The web app needs the API. Our hosted copy is switched off, so deploy your own first (see Model pipeline). modal deploy reef_app.py prints its URL. Then:

cd web
npm install
echo "VITE_API_URL=<your API URL>" > .env.local
npm run dev

Open the URL that Vite prints. The map, rankings and reef panels load from the API.

The 3D scans are not in git (about 300 MB). Rebuild them into web/public/scans/:

tools/fetch_scans.sh

Set SKETCHFAB_TOKEN to also fetch the Sketchfab scans. The script needs uv and curl.

Model pipeline

reef_app.py is a Modal app. It downloads NOAA Coral Reef Watch data, builds features, trains the models and serves the API.

modal run reef_app.py --stage prep
modal run reef_app.py --stage extract
modal run reef_app.py --stage features
modal run reef_app.py --stage trees
modal run reef_app.py --stage export
modal run reef_app.py::frames_all
modal run reef_app.py::years_all
modal deploy reef_app.py

prep downloads the bleaching surveys and the temperature climatology. extract downloads 40 years of daily NOAA heat at every reef cell. frames_all and years_all build the yearly bleaching map and the warming scenarios behind /years. Everything lands on the Modal volume reef-data.

The transformer comparison is optional: modal run reef_app.py --stage pipeline pretrains, fine-tunes and writes the results. It needs L40S GPUs for several hours.

The pipeline needs a Modal account. A full run takes several hours of cloud compute.

Static data

The site also loads files from web/public/data/. They are committed, so this step is only needed to refresh them. With the API deployed, set REEF_API to its URL and run:

uv run --with geopandas --with pyogrio --with scipy python tools/pressure.py
uv run --with pandas --with openpyxl --with scipy python tools/projects.py
uv run --with numpy --with rasterio python tools/people.py
python3 tools/fetch_impact.py && uv run --with numpy --with pandas --with requests --with scipy python tools/impact.py

pressure.py and projects.py read the WCS pressures and the restoration database committed under data/.

Data

Data Use License
NOAA Coral Reef Watch CoralTemp Daily sea temperature since 1985 Public domain
Global Coral Bleaching Database (van Woesik and Kratochwill 2022) Training labels CC BY 4.0
MERMAID (WCS) Independent validation CC BY 4.0
WCS local reef pressures (Andrello et al. 2022) Local pressure ranking MIT
Boström-Einarsson et al. 2020, Dryad Restoration project sites CC0
Allen Coral Atlas Habitat maps CC BY 4.0
Reef tourism (Spalding et al. 2017) and people protected from flooding (Burke and Spalding 2022), TNC Mapping Ocean Wealth What people would lose, summed within 25 km of each reef No licence stated; the app ships per-reef sums with credit
GHS-POP R2023A, epoch 2020 (Schiavina et al. 2023, JRC) People within 50 km of each reef CC BY 4.0
Soneva and Wildflow, Galapagos_3D, Sketchfab contributors 3D reef scans CC BY 4.0, credited in the app
Smithsonian 3D Coral models in the satellite view CC0

License

The code is MIT licensed. See LICENSE. Each dataset keeps its own license.

About

Open map that ranks 18,445 coral reefs by whether restoration there will survive the heat

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages