# What Programming Languages Are Used in WeatherNext? A Deep Dive into the Google DeepMind Codebase

> Discover the programming languages powering Google DeepMind's WeatherNext. Explore Python, JAX, JSON, and Markdown's roles in this advanced weather forecasting system.

- Repository: [Google DeepMind/weathernext](https://github.com/google-deepmind/weathernext)
- Tags: deep-dive
- Published: 2026-08-10

---

**WeatherNext is written primarily in Python with heavy reliance on the JAX library for accelerated numerical computing, supplemented by Jupyter notebooks for interactive demos, JSON for configuration, and Markdown for documentation.**

The WeatherNext repository from Google DeepMind represents a research-grade weather forecasting system. This article examines the programming languages that power this codebase, referencing specific implementation files and their roles in the architecture.

## Primary Language: Python

**Python serves as the sole programming language for all core model implementations**, data pipelines, utilities, and training scripts in WeatherNext. The codebase leverages JAX for just-in-time compilation and GPU/TPU acceleration rather than relying on native C or C++ extensions.

### Core Python Implementation Files

- [`weathernext/weathernext2/architecture.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture.py) — Defines the Fourier Graph Network (FGN) architecture used in WeatherNext 2
- [`weathernext/weathernext1_gen/transformer.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext1_gen/transformer.py) — Implements the diffusion transformer (GenCast) for probabilistic forecasting
- [`weathernext/utils/data_utils.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/utils/data_utils.py) — Handles loading, normalization, and preprocessing of weather datasets including ERA5 and HRES
- [`weathernext/weathernext2/architecture_utils.py`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/architecture_utils.py) — Provides model initialization and configuration utilities

### Loading a WeatherNext Model in Python

The standard entry point for model interaction uses the `architecture_utils` module:

```python
import jax
from weathernext.weathernext2 import architecture_utils

# Initialise the model architecture for the default configuration

model = architecture_utils.create_model()

# Load pretrained weights from .npz checkpoint

params = weathernext.utils.checkpoint.load_checkpoint(
    "WeatherNext2_<2025_model1>.npz"
)

# Combine architecture with trained parameters

model = weathernext.utils.checkpoint.restore_params(model, params)

```

This pattern demonstrates how WeatherNext uses Python's dynamic nature combined with JAX's functional programming model for machine learning workloads.

### Running Auto-Regressive Forecasts

Forecast generation relies on the `PredictorBase` class:

```python
from weathernext.utils.predictor_base import PredictorBase

# initial_state is an xarray with required input fields

predictor = PredictorBase(model)
forecast = predictor.run_rollout(initial_state, num_steps=10)

```

The `run_rollout` method handles the iterative prediction loop characteristic of weather forecasting models.

## Supporting Languages and Formats

### Jupyter Notebooks (.ipynb)

**Interactive Python environments serve as the primary user interface** for WeatherNext. The repository includes complete workflow demonstrations that require no additional coding.

The `docs/weathernext2/wn2_demo.ipynb` notebook provides end-to-end coverage:

```python
!pip install weathernext  # installs the Python package

from weathernext.weathernext2 import architecture_utils

# Subsequent cells handle loading, inference, and visualization

```

Notebooks bridge the gap between research implementation and practical application, allowing meteorologists to execute forecasts without writing boilerplate code.

### JSON Configuration Files

WeatherNext uses JSON for structured model configurations rather than Python-based config objects:

- [`weathernext/weathernext2/configs/WeatherNext2.json`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/configs/WeatherNext2.json) — Stores hyperparameters, layer specifications, and training settings

These files are parsed by Python utilities during model initialization, enabling reproducible experiments and easy parameter sweeps.

### Markdown Documentation

Documentation and guides use standard Markdown:

- [`README.md`](https://github.com/google-deepmind/weathernext/blob/main/README.md) — Installation instructions, quickstart guide, and architecture overview
- [`docs/weathernext1_gen/README.md`](https://github.com/google-deepmind/weathernext/blob/main/docs/weathernext1_gen/README.md) — Specific documentation for the GenCast probabilistic model

### Absence of Compiled Languages

**No C or C++ source files ship with the repository.** Performance-critical operations rely on:

1. JAX's XLA compiler for kernel fusion and optimization
2. Pre-compiled JAX/XLA binaries pulled as external dependencies
3. NumPy and SciPy's optimized BLAS/LAPACK bindings

This design choice keeps the codebase maintainable while achieving computational performance comparable to hand-tuned C++ implementations.

## Language Distribution and Architecture

| Component | Language / Format | Purpose |
|-----------|-------------------|---------|
| Model architecture | Python (.py) | Neural network definitions |
| Training & inference | Python (.py) | Optimization loops, data loading |
| User interface | Jupyter (.ipynb) | Interactive demonstrations |
| Configuration | JSON | Hyperparameter storage |
| Documentation | Markdown (.md) | Guides and API references |

The monolithic Python approach—uncommon in high-performance scientific computing—works because JAX abstracts hardware acceleration. The `jax.jit` decorator compiles Python functions to optimized XLA HLO, which then generates platform-specific machine code.

## Summary

- **WeatherNext is exclusively Python-based** for all source code, with no native C/C++ components in the repository
- JAX provides the performance layer through JIT compilation and automatic differentiation
- Jupyter notebooks (`wn2_demo.ipynb`) deliver the primary user experience for running forecasts
- JSON configuration files separate hyperparameters from implementation code
- The architecture prioritizes research flexibility over multi-language optimization

## Frequently Asked Questions

### Is WeatherNext written in C++ for performance?

No. While many weather models use C++ or Fortran for speed, WeatherNext achieves comparable performance through JAX's Python-to-XLA compilation pipeline. All source files in the repository use the `.py` extension, and compiled kernels come from the external JAX installation.

### What role do Jupyter notebooks play in WeatherNext?

Jupyter notebooks function as the main interface for non-developers. The `docs/weathernext2/wn2_demo.ipynb` notebook contains pre-written cells that handle model loading, inference execution, and result visualization without requiring users to write Python code.

### Does WeatherNext require compiled extensions?

No compilation of WeatherNext-specific code is required. The installation process (`pip install weathernext`) pulls pure Python packages. Performance acceleration comes from JAX's pre-built wheels, which include their own compiled XLA backends for CPU, GPU, and TPU.

### Can WeatherNext configurations be modified without changing code?

Yes. Model and training configurations reside in JSON files such as [`weathernext/weathernext2/configs/WeatherNext2.json`](https://github.com/google-deepmind/weathernext/blob/main/weathernext/weathernext2/configs/WeatherNext2.json). These are parsed at runtime by `architecture_utils.create_model()`, allowing parameter changes without code modifications.