# google-deepmind/weathernext architecture

> Architecture diagram of the GitHub repository google-deepmind/weathernext, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/google-deepmind/weathernext
- Repository: https://github.com/google-deepmind/weathernext

## Overview

#### 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: [`weathernext/weathernext2/architecture.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture.py) (WN2 composition), [`weathernext/utils/autoregressive.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/autoregressive.py) (Autoregressive rollout), [`docs/weathernext2/wn2_demo.ipynb`](https://github.com/google-deepmind/weathernext/blob/main/docs/weathernext2/wn2_demo.ipynb) (Demo notebooks), [`weathernext/weathernext1_gen/gencast.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/gencast.py) (GenCast orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wn2["WeatherNext 2"]
  node_wn2_config["WN2 configurations<br/>JSON model config<br/>[WeatherNext2.json]"]
  node_fgn["FGN<br/>generative forecast model<br/>[fgn.py]"]
  node_wn2_composition["WN2 composition<br/>model assembly<br/>[architecture.py]"]
  node_wn2_transforms["Architecture transforms<br/>model utilities"]
end

subgraph group_shared["Shared runtime"]
  node_data_boundary["Data and objectives<br/>modality normalization loss<br/>[data_modalities.py]"]
  node_xarray_layer["Xarray weather tensors<br/>JAX xarray structures<br/>[xarray_tree.py]"]
  node_rollout["Autoregressive rollout<br/>prediction execution<br/>[autoregressive.py]"]
  node_spatial_nn["Graph and attention substrate<br/>mesh neural components<br/>[typed_graph_net.py]"]
end

subgraph group_cyclones["Cyclone tracking"]
  node_tracker["Direct cyclone tracker<br/>forecast track derivation<br/>[direct_tracker.py]"]
  node_ibtracs["IBTrACS preparation<br/>historical track processing"]
end

subgraph group_legacy["Legacy models"]
  node_graphcast["GraphCast<br/>deterministic graph forecast<br/>[graphcast.py]"]
  node_gencast["GenCast orchestration<br/>diffusion ensemble forecast<br/>[gencast.py]"]
  node_denoiser["GenCast denoiser<br/>diffusion network<br/>[denoiser.py]"]
  node_solver["DPM solver<br/>diffusion sampler"]
end

node_notebooks["Demo notebooks<br/>user entry points<br/>[wn2_demo.ipynb]"]
node_weather_data[("ERA5 / HRES states<br/>external weather data")]
node_weights[("Pretrained weights<br/>external NPZ artifacts")]
node_ibtracs_data[("NOAA IBTrACS<br/>external observations")]

node_notebooks -->|"builds"| node_wn2_composition
node_notebooks -->|"runs demo"| node_graphcast
node_notebooks -->|"runs demo"| node_gencast
node_wn2_config -->|"selects variant"| node_wn2_composition
node_wn2_composition -->|"assembles"| node_fgn
node_wn2_transforms -->|"supports"| node_wn2_composition
node_weights -->|"loads parameters"| node_wn2_composition
node_weather_data -->|"provides states"| node_data_boundary
node_data_boundary -->|"normalizes variables"| node_xarray_layer
node_xarray_layer -->|"supplies states"| node_rollout
node_wn2_composition -->|"provides predictor"| node_rollout
node_rollout -->|"applies autoregressively"| node_fgn
node_spatial_nn -->|"computational substrate"| node_fgn
node_rollout -->|"forecast fields"| node_tracker
node_ibtracs_data -->|"ingests"| node_ibtracs
node_ibtracs -.->|"historical reference"| node_tracker
node_gencast -->|"denoises with"| node_denoiser
node_gencast -->|"samples with"| node_solver
node_spatial_nn -.->|"shared graph machinery"| node_graphcast

click node_notebooks "https://github.com/google-deepmind/weathernext/blob/main/docs/weathernext2/wn2_demo.ipynb"
click node_wn2_config "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/configs/WeatherNext2.json"
click node_fgn "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/fgn.py"
click node_wn2_composition "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture.py"
click node_wn2_transforms "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture_utils.py"
click node_data_boundary "https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/data_modalities.py"
click node_xarray_layer "https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/xarray_tree.py"
click node_rollout "https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/autoregressive.py"
click node_spatial_nn "https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/typed_graph_net.py"
click node_tracker "https://github.com/google-deepmind/weathernext/blob/main/weathernext/cyclones/direct_tracker.py"
click node_ibtracs "https://github.com/google-deepmind/weathernext/blob/main/weathernext/cyclones/ibtracs_processing_stages.py"
click node_graphcast "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_graph/graphcast.py"
click node_gencast "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/gencast.py"
click node_denoiser "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/denoiser.py"
click node_solver "https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/dpm_solver_plus_plus_2s.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wn2_config,node_fgn,node_wn2_composition,node_wn2_transforms toneBlue
class node_data_boundary,node_xarray_layer,node_rollout,node_spatial_nn toneAmber
class node_tracker,node_ibtracs toneMint
class node_graphcast,node_gencast,node_denoiser,node_solver toneRose
class node_notebooks,node_weather_data,node_weights,node_ibtracs_data toneNeutral
```

## Components

### WeatherNext 2

Primary forecast model and composition.

- [WN2 configurations](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/configs/WeatherNext2.json): JSON model config · Selects WeatherNext 2 and cyclone model variants. · `weathernext/weathernext2/configs/WeatherNext2.json`
- [FGN](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/fgn.py): generative forecast model · Functional Generative Network core. · `weathernext/weathernext2/fgn.py`
- [WN2 composition](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture.py): model assembly · Builds the configured high-level model. · `weathernext/weathernext2/architecture.py`
- [Architecture transforms](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture_utils.py): model utilities · `weathernext/weathernext2/architecture_utils.py`

### Shared runtime

Data, rollout, and neural spatial substrate.

- [Data and objectives](https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/data_modalities.py): modality normalization loss · Defines variables, normalization, and forecast objectives. · `weathernext/utils/data_modalities.py`
- [Xarray weather tensors](https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/xarray_tree.py): JAX xarray structures · Represents gridded model inputs and outputs. · `weathernext/utils/xarray_tree.py`
- [Autoregressive rollout](https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/autoregressive.py): prediction execution · Repeatedly applies a predictor to emit forecast states. · `weathernext/utils/autoregressive.py`
- [Graph and attention substrate](https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/typed_graph_net.py): mesh neural components · 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](https://github.com/google-deepmind/weathernext/blob/main/weathernext/cyclones/direct_tracker.py): forecast track derivation · Extracts cyclone tracks from forecast fields. · `weathernext/cyclones/direct_tracker.py`
- [IBTrACS preparation](https://github.com/google-deepmind/weathernext/blob/main/weathernext/cyclones/ibtracs_processing_stages.py): historical track processing · Separates observational track ingestion from forecast tracking. · `weathernext/cyclones/ibtracs_processing_stages.py`

### Legacy models

Retained WeatherNext 1 model families.

- [GraphCast](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_graph/graphcast.py): deterministic graph forecast · `weathernext/weathernext1_graph/graphcast.py`
- [GenCast orchestration](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/gencast.py): diffusion ensemble forecast · `weathernext/weathernext1_gen/gencast.py`
- [GenCast denoiser](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/denoiser.py): diffusion network · `weathernext/weathernext1_gen/denoiser.py`
- [DPM solver](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/dpm_solver_plus_plus_2s.py): diffusion sampler · `weathernext/weathernext1_gen/dpm_solver_plus_plus_2s.py`

### Other components

- [Demo notebooks](https://github.com/google-deepmind/weathernext/blob/main/docs/weathernext2/wn2_demo.ipynb): user entry points · WN2, GraphCast, and GenCast demonstrations. · `docs/weathernext2/wn2_demo.ipynb`
- **ERA5 / HRES states**: external weather data · Initial atmospheric conditions from ECMWF datasets.
- **Pretrained weights**: external NPZ artifacts · Downloaded from Google Cloud.
- **NOAA IBTrACS**: external observations

## Connections

- 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
