njord-forecasts / README.md
deinal's picture
Add files using upload-large-folder tool
b4b7048 verified
|
Raw History Blame Contribute Delete
10.2 kB
---
pretty_name: Njord global ocean forecasts for OceanBench
tags:
- ocean
- forecasting
- oceanbench
- ensemble
- njord
- zarr
---
# Njord global ocean forecasts for OceanBench (2024)
10-day global ocean forecasts from the Njord ML model ([paper](https://arxiv.org/abs/2605.15470)), prepared in the
[OceanBench](https://github.com/mercator-ocean/oceanbench) challenger format.
There is one forecast starting on each of the 52 Wednesdays of 2024.
The repository contains two datasets:
| Store | Contents | Dtype | Size on disk |
|---|---|---|---|
| `njord_forecasts.zarr` | Mean of the 20 ensemble members. This is the dataset evaluated with OceanBench. | float64 | 50 GB |
| `njord_ensemble_forecasts.zarr` | All 20 ensemble members | float32 | 521 GB |
Both stores have the same grid, variables, and coordinates. The ensemble store has
one extra `ensemble_member` dimension. The mean of its members reproduces
`njord_forecasts.zarr`.
## Files
| File | Purpose |
|---|---|
| `njord_forecasts.zarr` | Ensemble-mean forecasts (see above) |
| `njord_ensemble_forecasts.zarr` | 20-member ensemble forecasts (see above) |
| `njord_challenger.py` | OceanBench challenger file: opens all 52 ensemble-mean forecasts from this repository as `challenger_dataset` |
| `njord_sample.py` | Same as `njord_challenger.py`, but only the first forecast (2024-01-03), for a quick test |
| `njord_ensemble_challenger.py` | Challenger file for the full ensemble; keeps the `ensemble_member` dimension |
| `njord_ensemble_sample.py` | Same as `njord_ensemble_challenger.py`, but only the first forecast |
| `prepare_forecasts.py` | Converts Njord's native ensemble output to `njord_forecasts.zarr` (mean over members) |
| `prepare_ensemble_forecasts.py` | Converts Njord's native ensemble output to `njord_ensemble_forecasts.zarr` |
| `oceanbench_results/run_oceanbench_evaluation.py` | Runs the OceanBench metrics on `njord_forecasts.zarr` and writes the CSVs below |
| `oceanbench_results/njord_rmsd_to_glorys.csv`, `njord_rmsd_to_glo12.csv` | RMSD of each variable and depth against the GLORYS reanalysis and the GLO12 analysis, per lead day |
| `oceanbench_results/njord_geostrophic_rmsd_to_glorys.csv`, `njord_geostrophic_rmsd_to_glo12.csv` | RMSD of the surface geostrophic currents against GLORYS and GLO12 |
| `oceanbench_results/njord_rmsd_to_observation.csv` | RMSD against in-situ and satellite observations |
| `oceanbench_results/generate_simulation_tables.py` | Builds `glorys_results.tex` and `glo12_results.tex`: LaTeX scorecards comparing Njord with GLO12, GLONET, WENHAI, and XIHE |
| `oceanbench_results/generate_observation_table.py` | Builds `observation_results.tex`: the same comparison against observations |
| `oceanbench_results/*.tex` | The generated LaTeX scorecards |
The two `generate_*` scripts read the other models' scores from the OceanBench
evaluation reports (`assets/*.global.report.ipynb`). Run them from a checkout of the
OceanBench repository with these files available.
## Dimensions
| Dimension | Size | Values |
|---|---|---|
| `first_day_datetime` | 52 | 2024-01-03 to 2024-12-25, weekly (Wednesdays). This is the first forecast day, one day after initialisation. |
| `ensemble_member` | 20 | 0–19 (ensemble store only) |
| `lead_day_index` | 10 | 0–9 (forecast days 1–10) |
| `depth` | 6 | 0.494, 47.37, 92.33, 222.5, 318.1, 541.1 m (GLORYS levels) |
| `latitude` | 680 | −80 to 89.75, 1/4° |
| `longitude` | 1440 | −180 to 179.75, 1/4° |
Variable dimensions:
```
zos, siconc, sithick: (first_day_datetime, [ensemble_member,] lead_day_index, latitude, longitude)
thetao, so, uo, vo: (first_day_datetime, [ensemble_member,] lead_day_index, depth, latitude, longitude)
```
## Variables
| Name | Description | Unit |
|---|---|---|
| `zos` | Sea surface height above geoid | m |
| `thetao` | Sea water potential temperature | °C |
| `so` | Sea water salinity | PSU |
| `uo` | Eastward sea water velocity | m/s |
| `vo` | Northward sea water velocity | m/s |
| `siconc` | Sea ice concentration | fraction |
| `sithick` | Sea ice thickness | m |
OceanBench does not evaluate `siconc` and `sithick`; the challenger file drops them.
Chunking: one chunk holds one forecast × one member × one depth level, with all
10 lead days and the full global grid.
## Loading
```python
import xarray as xr
url = "https://huggingface.co/datasets/deinal/njord-forecasts/resolve/main"
mean = xr.open_zarr(f"{url}/njord_forecasts.zarr")
ensemble = xr.open_zarr(f"{url}/njord_ensemble_forecasts.zarr")
# e.g. ensemble spread of surface temperature for the first forecast
spread = ensemble.thetao.isel(first_day_datetime=0, depth=0).std("ensemble_member")
```
You can also download the files first. Both commands below fetch only the ensemble mean (50 GB);
drop the filter to get everything (~570 GB).
```sh
hf download deinal/njord-forecasts --repo-type dataset --include "njord_forecasts.zarr/*" --local-dir njord_forecasts
```
```python
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="deinal/njord-forecasts",
repo_type="dataset",
local_dir="njord_forecasts",
allow_patterns=["njord_forecasts.zarr/*"],
)
```
To evaluate with OceanBench:
```sh
oceanbench evaluate njord_challenger.py # all 52 forecasts
oceanbench evaluate njord_sample.py # first forecast only (2024-01-03), for a quick check
```
`njord_ensemble_challenger.py` and `njord_ensemble_sample.py` open the 20-member
ensemble in the same way. They keep `ensemble_member` as an extra dimension. OceanBench
currently evaluates deterministic forecasts only, so these files are for when it
supports ensembles. Ensemble support is likely to be tracked in
[mercator-ocean/oceanbench#248](https://github.com/mercator-ocean/oceanbench/issues/248).
## How the data was produced
The forecasts come from the [Njord repository](https://github.com/deinal/njord).
Njord's native output is one array `prediction(init_time, ensemble_member, lead_time, state_feature, longitude, latitude)`.
It has 27 state features such as `thetao_47m`. Two scripts convert it to the OceanBench layout:
- `prepare_forecasts.py` averages the 20 members and writes `njord_forecasts.zarr`. It keeps the model output's float64 storage.
- `prepare_ensemble_forecasts.py` keeps all members and writes `njord_ensemble_forecasts.zarr` in float32.
That is lossless, because the model computes in float32. It reads each input block once and can resume if interrupted.
Both scripts:
- split `state_feature` into variables and a `depth` dimension, restoring the exact GLORYS depth of each level (see below);
- map `init_time` to `first_day_datetime = init_time + 1 day`, and lead times of 1–10 days to `lead_day_index` 0–9;
- order the dimensions as `(first_day_datetime, [ensemble_member,] lead_day_index, [depth,] latitude, longitude)`.
**Depth levels.** Njord is trained on six native GLORYS levels, labelled with
whole-number depths in its training data:
| Njord label | GLORYS level (`depth` in the zarrs) | OceanBench label |
|---|---|---|
| 0 m | 0.494 m | surface |
| 47 m | 47.37 m | 50 m |
| 92 m | 92.33 m | 100 m |
| 222 m | 222.5 m | 200 m |
| 318 m | 318.1 m | 300 m |
| 541 m | 541.1 m | 500 m |
When the training data was downloaded, each label selected the single GLORYS level
within ±1 m of it. Only the coordinate was rounded; the values are GLORYS values at
that level. The prepare scripts map each label back to that level. These are exactly
the six depths OceanBench evaluates, so no vertical interpolation is involved
anywhere.
Both scripts were run from the Njord repository. Note that input paths are hardcoded and relative to it.
## OceanBench results
These results are for the ensemble mean (`njord_forecasts.zarr`). They were computed
locally with OceanBench `main` at commit
[`db2b572`](https://github.com/mercator-ocean/oceanbench/commit/db2b572) (2026-04-22). That is 13 commits after the
`v0.0.3` release. Values are RMSD.
- Full per-depth tables are in `oceanbench_results/*.csv`.
- LaTeX scorecards comparing Njord with GLO12, GLONET, WENHAI, and XIHE are in `oceanbench_results/*.tex`.
- `oceanbench_results/run_oceanbench_evaluation.py` is the script that produced the CSVs.
**vs GLO12 analysis (surface)**
| Variable | Day 1 | Day 5 | Day 10 |
|---|---:|---:|---:|
| Sea surface height (m) | 0.021 | 0.044 | 0.060 |
| Temperature (°C) | 0.185 | 0.385 | 0.512 |
| Salinity (PSU) | 0.107 | 0.228 | 0.300 |
| Zonal current (m/s) | 0.055 | 0.106 | 0.136 |
| Meridional current (m/s) | 0.057 | 0.106 | 0.132 |
| Zonal geostrophic current (m/s) | 0.076 | 0.120 | 0.149 |
| Meridional geostrophic current (m/s) | 0.067 | 0.113 | 0.141 |
**vs GLORYS reanalysis (surface)**
| Variable | Day 1 | Day 5 | Day 10 |
|---|---:|---:|---:|
| Sea surface height (m) | 0.070 | 0.077 | 0.082 |
| Temperature (°C) | 0.548 | 0.558 | 0.618 |
| Salinity (PSU) | 0.842 | 0.841 | 0.846 |
| Zonal current (m/s) | 0.121 | 0.121 | 0.134 |
| Meridional current (m/s) | 0.120 | 0.119 | 0.131 |
| Zonal geostrophic current (m/s) | 0.121 | 0.132 | 0.149 |
| Meridional geostrophic current (m/s) | 0.118 | 0.129 | 0.143 |
**vs observations**
| Variable | Depth | Day 1 | Day 5 | Day 10 |
|---|---|---:|---:|---:|
| Temperature (°C) | surface | 0.887 | 0.846 | 0.869 |
| Temperature (°C) | 0–5 m | 0.470 | 0.844 | 0.912 |
| Temperature (°C) | 5–100 m | 1.036 | 1.036 | 1.121 |
| Salinity (PSU) | 0–5 m | 0.245 | 0.268 | 0.312 |
| Salinity (PSU) | 5–100 m | 0.198 | 0.209 | 0.225 |
| Sea level anomaly (m) | surface | 0.113 | 0.117 | 0.122 |
| Zonal current (m/s) | 15 m | 0.202 | 0.211 | 0.220 |
| Meridional current (m/s) | 15 m | 0.188 | 0.199 | 0.207 |
The following metrics were not computed yet:
- Lagrangian trajectory deviation.
- Mixed layer depth RMSD. Got OOM.
## Citation
```
@inproceedings{holmberg2026njord,
title={Njord: A Probabilistic Graph Neural Network for Ensemble Ocean Forecasting},
author={Holmberg, Daniel and Oskarsson, Joel and Wikingsson, Erik and Lindsten, Fredrik and Roos, Teemu},
booktitle={Advances in Neural Information Processing Systems},
volume={39},
year={2026}
}
```