How google-deepmind/weathernext works
Purpose and entry points
WeatherNext is a research/inference library for global medium-range atmospheric forecasting, centered on WeatherNext 2 (WN2) and cyclone forecasting, while retaining GraphCast and GenCast implementations. There is no standalone service entry point; primary user entry points are notebooks: docs/weathernext2/wn2_demo.ipynb, docs/weathernext1_graph/graphcast_demo.ipynb, and docs/weathernext1_gen/gencast_mini_demo.ipynb. Package installation is defined by setup.py.
WN2 forecasting architecture
WN2’s main model is a Functional Generative Network (FGN), implemented in weathernext/weathernext2/fgn.py, with high-level model composition in weathernext/weathernext2/architecture.py. Architecture support and transformations live in weathernext/weathernext2/architecture_utils.py. Versioned model shapes/behavior are selected from JSON configurations, including weathernext/weathernext2/configs/WeatherNext2.json and weathernext/weathernext2/configs/WeatherNextCyclones.json.
Forecast execution flow
The expected flow is: load external pretrained .npz weights and initial atmospheric conditions; construct the configured WN2/FGN model; normalize and represent gridded weather inputs; repeatedly apply the model autoregressively to emit forecast states; then optionally evaluate loss or derive cyclone tracks. Shared execution abstractions are in weathernext/utils/predictor_base.py, weathernext/utils/autoregressive.py, and weathernext/utils/rollout.py. Model inputs/outputs are designed around JAX-compatible xarray structures in weathernext/utils/xarray_tree.py and weathernext/utils/xarray_dense.py.
Neural and spatial building blocks
The shared utils layer supplies reusable neural architecture machinery rather than one model-specific implementation: typed graph representations and message passing in weathernext/utils/typed_graph.py and weathernext/utils/typed_graph_net.py; mesh/topology construction in weathernext/utils/icosahedral_mesh.py; and transformer attention components in weathernext/utils/mesh_transformer.py and weathernext/utils/sparse_transformer.py. WN2 uses these as its computational substrate, with hardware-sensitive attention choices noted by the WN2 demo.
Data, normalization, and learning boundary
External ERA5 reanalysis or operational ECMWF HRES initial-condition data enter as weather-state datasets; pretrained weights arrive separately from the Google Cloud bucket. Common modality definitions, variable handling, normalization, and objectives are separated into weathernext/utils/data_modalities.py, weathernext/utils/normalization.py, weathernext/utils/variables.py, and weathernext/utils/losses.py. This boundary permits both forecast inference and notebook-level gradient/loss experimentation without embedding data acquisition in the core model packages.
Cyclone tracking pipeline
Cyclone prediction is derived from forecast fields through a direct tracking subsystem rather than a separate forecast model. weathernext/cyclones/direct_tracker.py implements tracking behavior atop weathernext/cyclones/tracker_base.py, while weathernext/cyclones/tracker_utils.py and weathernext/cyclones/cyclone_utils.py support track processing. Historical IBTrACS ingestion/processing is isolated in weathernext/cyclones/ibtracs_netcdf_to_csv.py and weathernext/cyclones/ibtracs_processing_stages.py, separating observational track preparation from forecast-time tracking.
Legacy model families and runtime infrastructure
GraphCast’s deterministic graph forecast path is contained in weathernext/weathernext1_graph/graphcast.py. GenCast’s diffusion ensemble path consists of orchestration in weathernext/weathernext1_gen/gencast.py, denoising in weathernext/weathernext1_gen/denoiser.py, and sampling/solver code in weathernext/weathernext1_gen/dpm_solver_plus_plus_2s.py. The intended runtime is accelerator-oriented JAX, optimized for TPUs; GPU execution is supported with attention changes and sufficient VRAM. External dependencies/services include Google Cloud-hosted weights/data, ECMWF ERA5/HRES datasets, and NOAA IBTrACS.
Main entry points: architecture.py WN2 composition · autoregressive.py Autoregressive rollout · wn2_demo.ipynb Demo notebooks · gencast.py GenCast orchestration
Components 18
WeatherNext 2
Primary forecast model and composition.
- WN2 configurations · Selects WeatherNext 2 and cyclone model variants.
weathernext/weathernext2/configs/WeatherNext2.json - FGN · Functional Generative Network core.
weathernext/weathernext2/fgn.py - WN2 composition · Builds the configured high-level model.
weathernext/weathernext2/architecture.py - Architecture transforms
weathernext/weathernext2/architecture_utils.py
Shared runtime
Data, rollout, and neural spatial substrate.
- Data and objectives · Defines variables, normalization, and forecast objectives.
weathernext/utils/data_modalities.py - Xarray weather tensors · Represents gridded model inputs and outputs.
weathernext/utils/xarray_tree.py - Autoregressive rollout · Repeatedly applies a predictor to emit forecast states.
weathernext/utils/autoregressive.py - Graph and attention substrate · Typed graphs, icosahedral meshes, and sparse/mesh attention.
weathernext/utils/typed_graph_net.py
Cyclone tracking
Forecast-derived tracking and historical preparation.
- Direct cyclone tracker · Extracts cyclone tracks from forecast fields.
weathernext/cyclones/direct_tracker.py - IBTrACS preparation · Separates observational track ingestion from forecast tracking.
weathernext/cyclones/ibtracs_processing_stages.py
Legacy models
Retained WeatherNext 1 model families.
- GraphCast
weathernext/weathernext1_graph/graphcast.py - GenCast orchestration
weathernext/weathernext1_gen/gencast.py - GenCast denoiser
weathernext/weathernext1_gen/denoiser.py - DPM solver
weathernext/weathernext1_gen/dpm_solver_plus_plus_2s.py
Other components
- Demo notebooks · WN2, GraphCast, and GenCast demonstrations.
docs/weathernext2/wn2_demo.ipynb - ERA5 / HRES states · Initial atmospheric conditions from ECMWF datasets.
- Pretrained weights · Downloaded from Google Cloud.
- NOAA IBTrACS
Connections 19
- Demo notebooks → WN2 composition: builds
- Demo notebooks → GraphCast: runs demo
- Demo notebooks → GenCast orchestration: runs demo
- WN2 configurations → WN2 composition: selects variant
- WN2 composition → FGN: assembles
- Architecture transforms → WN2 composition: supports
- Pretrained weights → WN2 composition: loads parameters
- ERA5 / HRES states → Data and objectives: provides states
- Data and objectives → Xarray weather tensors: normalizes variables
- Xarray weather tensors → Autoregressive rollout: supplies states
- WN2 composition → Autoregressive rollout: provides predictor
- Autoregressive rollout → FGN: applies autoregressively
- Graph and attention substrate → FGN: computational substrate
- Autoregressive rollout → Direct cyclone tracker: forecast fields
- NOAA IBTrACS → IBTrACS preparation: ingests
- IBTrACS preparation → Direct cyclone tracker: historical reference
- GenCast orchestration → GenCast denoiser: denoises with
- GenCast orchestration → DPM solver: samples with
- Graph and attention substrate → GraphCast: shared graph machinery