How to Use WeatherNext for Forecasting: A Complete Guide to DeepMind's Weather AI

To use WeatherNext for forecasting, install the Python package, download pretrained weights, load ERA5/HRES initial conditions, initialize the Functional Generative Network (FGN) predictor, and run an auto-regressive rollout to generate multi-day global forecasts.

WeatherNext is Google DeepMind's family of deep-learning weather-forecasting models, with WeatherNext 2 (WN2) as the latest release. The repository provides a complete inference pipeline for global atmospheric prediction at 0.25° resolution, including specialized tropical cyclone tracking. This guide walks through the exact steps to run forecasts using the official source code.

Install WeatherNext and Download Weights

Start by installing the package from the GitHub repository. Pinning to a specific release ensures reproducibility.

pip install git+https://github.com/google-deepmind/weathernext.git@v0.3.0

Pretrained model weights are hosted in a public Google Cloud bucket. The helper module weathernext/utils/model_utils.py fetches these automatically when you initialize a predictor. No manual download is required.

Load Initial Conditions from ERA5 or HRES

WeatherNext expects input data as xarray Datasets with specific atmospheric variables. The utilities in weathernext/utils/data_utils.py handle reading ERA5 or HRES Zarr files and preparing them for the model.

import weathernext.utils.data_utils as data_utils

# Load ERA5 initial conditions

init_state = data_utils.load_input_data(
    data_path="gs://weather-datasets/era5/2024/01.zarr",
    variables=["temperature", "geopotential", "u_component_of_wind", 
               "v_component_of_wind", "specific_humidity"],
    lead_time="0h"
)

This module also manages forecast lead-time coordinates and ensures all required variables are present and correctly shaped.

Initialize the FGN Predictor

WeatherNext 2 uses a Functional Generative Network (FGN)—a transformer architecture operating on a spherical icosahedral mesh. The predictor class is defined in weathernext/weathernext2/fgn.py.

from weathernext.weathernext2.fgn import FGNPredictor

# Load predictor from JSON config

predictor = FGNPredictor.from_config(
    "weathernext/weathernext2/configs/WeatherNextCyclones_Mini.json"
)

The architecture implementation lives in weathernext/weathernext2/architecture.py, which defines the spherical transformer layers and attention mechanisms. The FGNPredictor wraps this architecture with methods for one-step forward prediction.

Run Auto-Regressive Rollout

Forecasts are generated auto-regressively: the model repeatedly predicts the next timestep and feeds that prediction back as input. The weathernext/utils/autoregressive.py module orchestrates this loop.

from weathernext.utils import autoregressive

# Define forecast lead times (e.g., 10 days at 6-hour steps)

lead_times = [f"{6*h}h" for h in range(0, 41)]  # 0h to 240h

# Generate multi-step forecast

forecast = autoregressive.autoregressive_rollout(
    predictor=predictor,
    init_state=init_state,
    lead_times=lead_times
)

The autoregressive_rollout function:

  • Iteratively calls predictor.predict_step()
  • Stacks predictions into an xarray Dataset with time coordinates
  • Handles normalization and denormalization automatically

Track Tropical Cyclones

WeatherNext includes a specialized cyclone tracker that converts gridded forecasts into storm tracks. Use weathernext/cyclones/direct_tracker.py for post-processing.

from weathernext.cyclones import direct_tracker

# Extract cyclone tracks from forecast

tracks = direct_tracker.track_cyclones(
    forecast=forecast,
    min_slp_threshold=100000.0,  # Pa

    max_wind_threshold=17.5      # m/s

)

The direct_tracker identifies local minima in sea-level pressure and wind speed maxima, then links them across timesteps using proximity-based association.

Quick-Start with the Demo Notebook

The fastest way to understand the full pipeline is the official Colab notebook: docs/weathernext2/wn2_demo.ipynb. This notebook demonstrates:

  • Loading the Mini model for faster inference
  • Running a 10-day global forecast
  • Visualizing temperature and wind fields with Matplotlib
  • Extracting and plotting tropical cyclone tracks

Open it directly in Google Colab via the badge in the README.md.

Key Modules Reference

Module Purpose
weathernext/weathernext2/architecture.py Spherical transformer mesh and attention layers
weathernext/weathernext2/fgn.py FGN predictor for one-step inference
weathernext/utils/autoregressive.py Multi-step rollout orchestration
weathernext/utils/data_utils.py ERA5/HRES data loading and lead-time handling
weathernext/utils/normalization.py Input/output scaling transforms
weathernext/utils/model_utils.py Weight downloading and checkpoint management
weathernext/cyclones/direct_tracker.py Tropical cyclone track extraction

Summary

  • WeatherNext 2 provides pretrained deep-learning models for global weather forecasting at 0.25° resolution
  • Install via pip and let model_utils.py handle weight downloads automatically
  • Use data_utils.py to load ERA5/HRES initial conditions into xarray format
  • Initialize the FGN predictor from JSON configs in weathernext2/configs/
  • Run forecasts with autoregressive_rollout() from utils/autoregressive.py
  • Apply cyclone tracking with direct_tracker.py for tropical storm analysis
  • Reference the wn2_demo.ipynb notebook for complete working examples

Frequently Asked Questions

What hardware is required to run WeatherNext forecasts?

The Mini model runs on a single GPU with ~16GB VRAM. Full-resolution models require TPU access or multi-GPU setups. The codebase supports JAX compilation for XLA-optimized inference on both hardware types.

Can WeatherNext forecast beyond 10 days?

Yes. The auto-regressive architecture supports arbitrary rollout lengths, though accuracy degrades beyond medium-range horizons (10-15 days) due to error accumulation. The lead_times parameter accepts any list of time deltas.

How does the cyclone tracker differ from traditional methods?

The direct tracker analyzes the model's native grid output without downscaling, using learned pressure and wind fields directly. This avoids interpolation artifacts common in reanalysis-based tracking and captures fine-scale storm structure resolved by the 0.25° model.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →