NanoCast · Udgam Labs

UDGAM LABS · Weather model · 40M parameters

NanoCast-40M

NanoCast is a 40M-parameter global weather model. From two snapshots of the atmosphere 6 hours apart, it predicts the next 6 hours, and repeats that 40 times for a 10-day forecast of the whole planet on a 1.5° grid (temperature, wind, pressure and humidity at 8 heights, plus surface weather and rain). The model is one 80.2 MB ONNX file. In Chrome, on your own graphics chip through WebGPU, the 40 steps take about 3 seconds on a Mac mini, with no server.

Try it: in your browser · code on GitHub · udgamlabs.com/models/nanocast

Hurricane Ian, 10 m wind speed 72 hours after the start: NanoCast's forecast on the left, ERA5 on the right

Hurricane Ian, 10 m wind speed. Started from ERA5 on 25 Sep 2022, 00 UTC; NanoCast at +72 h (left) and ERA5 at the same time (right), as drawn by the demo. The forecast storm sits a little south-west of where it really was.

Quick start

In Python (ONNX Runtime)

pip install onnxruntime numpy huggingface_hub
import json, numpy as np, onnxruntime as ort
from huggingface_hub import hf_hub_download

repo = "udgamlabs/NanoCast-40M"
get = lambda f: hf_hub_download(repo, f)
cfg = json.load(open(get("config.json")))
stats = json.load(open(get("stats.json")))
mean = np.array(stats["mean"], np.float32)[:, None, None]
std = np.array(stats["std"], np.float32)[:, None, None]
sess = ort.InferenceSession(get("nanocast_40m_fp16.onnx"))

# Start: two states 6 h apart (Hurricane Ian, 2022-09-25 00 UTC, from ERA5), raw float16 [2, 44, 121, 240]
start = cfg["samples"][0]
x = np.fromfile(get(start["file"]), "<f2").astype(np.float32).reshape(2, 44, 121, 240)
prev, cur = ((x - mean) / std).astype(np.float16)[:, None]

# Forcings: orography, land-sea mask, sin and cos of latitude, sunlight at t and t+6h
lat = np.deg2rad(np.arange(121) * 1.5 - 90)[:, None]
lon = np.deg2rad(np.arange(240) * 1.5)[None, :]
def sun(ts):  # cos(solar zenith) at the top of the atmosphere, clipped at 0
    d = (ts - 946728000) / 86400; g = np.deg2rad((357.529 + 0.98560028 * d) % 360)
    lam = np.deg2rad((280.459 + 0.98564736 * d) % 360 + 1.915 * np.sin(g) + 0.02 * np.sin(2 * g))
    sd = np.sin(np.deg2rad(23.439 - 3.6e-7 * d)) * np.sin(lam)
    ha = ((ts % 86400) / 3600 - 12) * np.pi / 12 + lon
    cz = np.sin(lat) * sd + np.cos(lat) * np.sqrt(1 - sd * sd) * np.cos(ha)
    return np.maximum(cz, 0) * (1 + 0.0334 * np.cos(g))
forc = np.zeros((1, 6, 121, 240), np.float32)
forc[0, :2] = np.fromfile(get("static_240x121.bin"), "<f4").reshape(2, 121, 240)
forc[0, 2], forc[0, 3] = np.sin(lat), np.cos(lat)

t0 = start["timestamp_s"]
for step in range(1, 41):  # 40 steps of 6 h = 10 days
    forc[0, 4], forc[0, 5] = sun(t0 + (step - 1) * 21600), sun(t0 + step * 21600)
    nxt, rain = sess.run(None, {"x_prog": cur, "x_prev": prev, "x_forc": forc.astype(np.float16)})
    prev, cur = cur, nxt
    if step == 12:  # +72 h: lowest sea-level pressure around the Gulf of Mexico
        mslp = (cur[0, 43].astype(np.float32) * std[43] + mean[43] + 101325) / 100
        print(f"+72 h, Hurricane Ian: lowest pressure {mslp[70:84, 177:194].min():.1f} hPa")

# London, day 10: 2 m temperature (channel 40, stored in deg C)
y, x = round((51.5 + 90) / 1.5), round((-0.13 % 360) / 1.5) % 240
print(f"+240 h, London grid point: {cur[0, 40, y, x] * std[40, 0, 0] + mean[40, 0, 0]:.1f} °C")

It prints the storm's lowest pressure at +72 h (996.1 hPa; ERA5 had 992.0 hPa on the same grid) and a day-10 temperature. On a Mac mini's CPU the 40 steps took 7 to 12 seconds. examples/forecast.py in the GitHub repository does the same with options for your own start, any place and saving the forecast.

In the browser (JavaScript, Chrome or Edge with WebGPU)

import * as ort from 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.31.1/dist/ort.webgpu.min.mjs'

const hf = 'https://huggingface.co/udgamlabs/NanoCast-40M/resolve/main/'
const cfg = await (await fetch(hf + 'config.json')).json()
const stats = await (await fetch(hf + 'stats.json')).json()
const model = await ort.InferenceSession.create(hf + cfg.model_file, { executionProviders: ['webgpu'] })
const bytes = async (f) => (await fetch(hf + f)).arrayBuffer()

const N = 121 * 240, C = 44
const raw = new Float16Array(await bytes(cfg.samples[0].file))            // [2, 44, 121, 240]: t-6h, then t
const norm = (k) => Float16Array.from({ length: C * N }, (_, i) => {
  const c = Math.floor(i / N); return (raw[k * C * N + i] - stats.mean[c]) / stats.std[c]
})
let prev = new ort.Tensor('float16', norm(0), [1, C, 121, 240])
let cur = new ort.Tensor('float16', norm(1), [1, C, 121, 240])

// Forcings [6, 121, 240]: orography and land-sea mask from the file, sin and cos of latitude, then
// sunlight at t and t+6h (computeToaSolarFrame in web/physics.js on GitHub; zeros here for brevity).
const forc = new Float32Array(6 * N)
forc.set(new Float32Array(await bytes(cfg.static_file)), 0)
for (let y = 0; y < 121; y++) for (let x = 0; x < 240; x++) {
  const lat = (y * 1.5 - 90) * Math.PI / 180
  forc[2 * N + y * 240 + x] = Math.sin(lat); forc[3 * N + y * 240 + x] = Math.cos(lat)
}
const out = await model.run({ x_prog: cur, x_prev: prev, x_forc: new ort.Tensor('float16', Float16Array.from(forc), [1, 6, 121, 240]) })
prev = cur; cur = out.next_prog                                            // repeat 40 times for 10 days
const t2m = (await cur.getData())[40 * N + 94 * 240] * stats.std[40] + stats.mean[40]
console.log('+6 h, 2 m temperature at 51°N 0°E:', t2m.toFixed(1), '°C')

Float16Array needs a recent Chrome or Edge. The full demo (globe, storms, any place, today's start) is in web/ on GitHub; it fills in the sunlight and works with raw Uint16Array bits instead.

Inputs and outputs

Name Type Shape What it is
x_prog (in) float16 [1, 44, 121, 240] The state at time t, normalized with stats.json
x_prev (in) float16 [1, 44, 121, 240] The state at t − 6 h, normalized the same way
x_forc (in) float16 [1, 6, 121, 240] Orography, land-sea mask, sin and cos of latitude, top-of-atmosphere sunlight at t and at t + 6 h
next_prog (out) float16 [1, 44, 121, 240] The state at t + 6 h, normalized: feed it back as x_prog
diag (out) float16 [1, 1, 121, 240] Rain over the 6 hours, as log(1 + mm)

The 44 channels are geopotential, temperature, east and north wind and specific humidity at 1000, 925, 850, 700, 500, 300, 200 and 100 hPa (40 channels), then 2 m temperature, 10 m east and north wind and sea-level pressure. The grid runs south to north from −90° and east from 0°, every 1.5°. config.json lists every channel, its units and offset.

Files

File Size What it is
nanocast_40m_fp16.onnx 80.2 MB The model (opset 18, float16)
nanocast_40m.safetensors 159.5 MB The same model in PyTorch (float32 EMA weights), for fine-tuning; see below
config.json small Grid, levels, channels and units, input and output names and shapes, sample list
stats.json small Per-channel mean and standard deviation for normalizing
static_240x121.bin 232 KB Orography (normalized) and land-sea mask, float32 [2, 121, 240]
samples/ian_2022-09-25T00Z.bin 5.1 MB A start: Hurricane Ian, from ERA5, float16 [2, 44, 121, 240]
samples/ian_2022-09-25T00Z_era5_truth.bin 1.2 MB ERA5 at +24, +72, +120, +168 and +240 h for checking it (4 surface fields)
SHA256SUMS small Checksums

Results

Held-out year 2022, WeatherBench 2 setup, 1.5° grid, global. NanoCast was scored by us on all 730 starts of 2022 (00 and 12 UTC), 40 steps each, against ERA5, latitude-weighted [MEASURED, 2 Dec 2026]. The other rows are the published WeatherBench 2 scores for 2022 at the same grid [EXTERNAL, read from the WeatherBench 2 files, not re-run by us]. Lower is better. Our own scoring script follows the WeatherBench 2 recipe but is not the official WeatherBench 2 code.

2 m temperature, RMSE (°C)

Day 1 Day 3 Day 5 Day 7 Day 10
NanoCast-40M [MEASURED] 0.81 1.14 1.57 2.08 2.74
ECMWF IFS HRES 0.90 1.14 1.53 2.03 2.69
GraphCast 0.50 0.81 1.24 1.78 2.52
Aurora 0.85 1.02 1.35 1.77 2.34
Pangu-Weather 0.57 0.92 1.40 1.96 2.67
Climatology 2.55 2.55 2.55 2.55 2.55
Persistence 2.03 2.90 3.18 3.34 3.49

500 hPa geopotential (Z500), RMSE (m²/s²)

Day 1 Day 3 Day 5 Day 7 Day 10
NanoCast-40M [MEASURED] 58 172 348 548 798
ECMWF IFS HRES 47 139 308 523 811
GraphCast 39 122 270 460 733
Aurora 43 121 264 444 671
Pangu-Weather 45 134 296 503 789
Climatology 809 810 810 811 813
Persistence 606 958 1,049 1,083 1,117

850 hPa temperature, sea-level pressure and 10 m wind, RMSE

T850 day 1 / 5 / 10 (°C) Pressure day 1 / 5 / 10 (Pa) Wind day 1 / 5 / 10 (m/s)
NanoCast-40M [MEASURED] 0.77 / 1.90 / 3.61 71 / 345 / 740 0.92 / 2.09 / 3.07
ECMWF IFS HRES 0.82 / 1.85 / 3.65 63 / 312 / 755 0.75 / 1.92 / 3.02
GraphCast 0.51 / 1.55 / 3.36 48 / 273 / 686 0.59 / 1.72 / 2.85
Aurora 0.72 / 1.53 / 3.00 57 / 267 / 627 0.62 / 1.72 / 3.06
Pangu-Weather 0.62 / 1.71 / 3.56 56 / 297 / 731 0.65 / 1.80 / 2.93
Climatology 3.41 / 3.41 / 3.42 716 / 718 / 720 2.43 / 2.43 / 2.43

What this shows, in plain words:

  • On day-1 2 m temperature NanoCast's error is 0.81 °C, against 0.90 °C for ECMWF's HRES, 0.85 °C for Aurora and 0.50 °C for GraphCast.
  • Against HRES it is level or lower on day-1 temperatures (2 m and 850 hPa), and lower at day 10 on Z500, 850 hPa temperature and pressure, where every model is close to climatology; it is behind HRES on the other scores in the first week.
  • It is behind GraphCast and Pangu-Weather on every score in these tables, and behind Aurora on all but day-1 2 m temperature.
  • Anomaly correlation for Z500 is 0.998 at day 1, 0.905 at day 5 and 0.757 at day 7 (2022) [MEASURED]: above the usual 0.6 line for about a week. At day 10 it is 0.48, and every model's error is close to climatology's.
  • The second held-out year, 2020 (732 starts), gives nearly the same numbers (day-1 2 m temperature 0.80 °C, Z500 at day 5 346) [MEASURED].
  • Stable: no NaN in 1,462 ten-day forecasts (2020 and 2022) [MEASURED].
  • Speed: 40 steps in Chrome (WebGPU) on a Mac mini took 2.4–2.5 s in our first runs and 3.4 s in later runs with the globe drawing included [MEASURED, 2–3 Dec 2026]; 7 to 12 s on the same Mac's CPU with ONNX Runtime in Python. Not yet measured on other machines.
  • Size: 39.9M parameters; the float16 ONNX file is 80.2 MB. Over 40 steps the float16 ONNX and the float32 PyTorch model differ by under 0.2% on a storm case (Amphan, Z500 and 2 m temperature RMSE) [MEASURED].

Where it falls short

  • A coarse grid. One grid point covers about 166 × 166 km at the equator. Forecasts are regional, not street-level: valleys, coasts, cities and mountain weather are smoothed out. Hurricanes come out broad and shallow; in the Ian example its lowest pressure is 996 hPa at +72 h (ERA5 on the same grid: 992 hPa), far above what was measured in the real eye.
  • Behind the large models. It trails GraphCast and Pangu-Weather on every score above, Aurora on all but one, and ECMWF's HRES on most scores in the first week. Those models run at 0.25° (HRES at about 0.1°) with many more levels.
  • Skill fades after about a week. By day 10 its errors are close to climatology's, like everyone's; days 8–10 are a rough guide at best.
  • One forecast, no spread. It is deterministic: no ensemble and no measure of how sure it is, and extremes soften at long range.
  • Rain is not scored. The model outputs 6-hour rain, but the tables above do not cover it, and the demo's ERA5 comparison for past storms has no rain field.
  • Today's start is not ERA5. The demo's live forecast starts from NOAA's GFS analysis (0.5°, regridded to 1.5°), not from ERA5, which the model was trained and scored on. It runs stably from GFS starts, but we have not yet scored those forecasts over a season.
  • Not for safety decisions. For warnings and anything that matters, use your national weather service.
  • Desktop browsers for speed. The demo needs WebGPU (Chrome or Edge) and an 80 MB download.

How it was trained

  • Data. ERA5 reanalysis at 1.5° (240 × 121 grid with poles) from the WeatherBench 2 archive, 6-hourly: 1979–2019 for training (59,879 steps), 2021 for validation, 2020 and 2022 held out for testing.
  • Inputs. 44 channels of the atmosphere at t and t − 6 h, plus six forcings: orography, land-sea mask, sin and cos of latitude, and analytic top-of-atmosphere sunlight at t and t + 6 h. Rain (6-hour total) is predicted as an extra output.
  • Model. A U-Net on the sphere (channels 64, 160, 320 and 512; padding that wraps around the globe and across the poles) with six global attention layers at its 16 × 30 bottleneck, predicting the 6-hour change. Trained from random weights.
  • Training. 75,000 one-step updates (batch 32, learning rate 4e-4, EMA 0.9995, bfloat16), then 15,000 updates rolling out its own forecasts for 2, 4, 8, 12, 16 and 20 steps, so it learns to correct its own errors.
  • Compute. About 10.3 hours of training on one NVIDIA RTX 6000 Ada (48 GB) [MEASURED].
  • Export. Float16 ONNX, opset 18, batch norm folded into the convolutions so it runs in WebGPU.

Fine-tuning

The PyTorch weights are on Hugging Face as nanocast_40m.safetensors (159.5 MB, float32, the EMA weights the ONNX file was exported from). src/train.py is the script NanoCast was trained with; started from those weights, it fine-tunes them, for example on recent years or with a longer rollout.

git clone https://github.com/udgamlabs/nanocast && cd nanocast
pip install -r requirements-train.txt
hf download udgamlabs/NanoCast-40M nanocast_40m.safetensors stats.json --local-dir released

# ERA5 at 1.5° for the period you want (2021 here: about 3.8 GB)
python src/data_prep.py --res 240x121 --levels 8 --start-date 2021-01-01T00:00 --end-date 2021-12-31T18:00 \
  --train-end 2021-12-31T18:00 --out data_2021 --skip-clim

# One-step updates, then a short rollout curriculum (K:steps:learning rate[:batch])
python src/train.py --data-dir data_2021 --out-dir runs/ft --init-from released/nanocast_40m.safetensors \
  --stats-from released --two-step --batch-size 8 --lr 3e-5 --stage1-steps 5000 \
  --curriculum "2:1000:2e-5,4:1000:1e-5" --val-year 2021 --load-in-ram

# Back to float16 ONNX for the browser or ONNX Runtime
python src/export_onnx.py --ckpt runs/ft/milestones/rollout_k4_g7000.pt --out runs/ft/nanocast_ft_fp16.onnx
  • Keep --stats-from released: the weights expect inputs normalised with the pretraining statistics, not ones computed from your period. Keep --two-step: the model reads the state at t and at t − 6 h.
  • train.py writes final_ema.safetensors and step-numbered .pt checkpoints; export_onnx.py and eval_wb2.py (with --stats-from released) take either format.
  • Choose a validation year you don't train on if you want an honest check; score on a held-out year with eval_wb2.py.
  • If you publish a fine-tuned model, set base_model: udgamlabs/NanoCast-40M in its model card, so it links back.

What we checked [MEASURED, 5 Dec 2026, Mac mini, Apple GPU]: the safetensors weights exported with export_onnx.py give the released ONNX file byte for byte (same SHA-256); 40 fine-tuning updates on six days of January 2022 ran in about 25 seconds, and the day-1 error before them (Z500 about 58 m²/s²) matches the published score. We have not run a full fine-tune.

Intended use and limitations

A research and teaching model: a small, open global weather model you can run, study and build on, on a laptop or in a browser. It is not an operational forecast and must not be used for warnings or safety decisions. Starts other than ERA5 (such as GFS) work but are not scored.

Licence

Apache-2.0 for the weights and code. The training data, statistics, static fields and sample start come from ERA5 (Copernicus Climate Change Service, CC-BY-4.0); see NOTICE. Generated using Copernicus Climate Change Service information (2026). Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.

Citation

@misc{udgamlabs2026nanocast,
  title  = {NanoCast-40M: a 10-day global weather model that runs in your browser},
  author = {{Udgam Labs}},
  year   = {2026},
  url    = {https://huggingface.co/udgamlabs/NanoCast-40M}
}

Scores for the other models come from WeatherBench 2: Rasp et al. (2024), "WeatherBench 2: A benchmark for the next generation of data-driven global weather models", Journal of Advances in Modeling Earth Systems.

NanoCast by Udgam Labs.


About Udgam Labs. Udgam Labs is an independent AI research lab. We work from first principles: before we build, we understand why things work, whether we are training a model, fine-tuning one or applying AI to a new problem. Udgam (उद्गम) is Sanskrit for origin. udgamlabs.com

Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using udgamlabs/NanoCast-40M 1

Collection including udgamlabs/NanoCast-40M