WeatherNext API Documentation: A Complete Guide to Public Endpoints and Python Interfaces

WeatherNext provides official API documentation through the OpenMeteo WeatherNext API and Google Developers WeatherNext Guide, while the internal Python interface is defined in weathernext/utils/predictor_base.py.

WeatherNext by Google DeepMind offers multiple pathways to access its AI-powered weather forecasts, ranging from public HTTP endpoints to programmable Python interfaces. Whether you need to query forecast data for a specific location or integrate the model into your own pipeline, understanding the available weathernext api documentation is essential for successful implementation. This guide covers both the external documentation portals and the internal codebase interfaces, referencing specific source files from the google-deepmind/weathernext repository.

Public API Documentation Portals

WeatherNext exposes forecast data through two primary documentation hubs. Both platforms are referenced in the repository's README (lines 19-23 in the "Accessing Forecast Data Feeds" section and lines 26-33 in the "Learn More" section).

OpenMeteo WeatherNext API

The OpenMeteo WeatherNext API provides a simple HTTP/JSON endpoint that returns WeatherNext 2 forecast fields—including temperature, wind, and geopotential—for any location and time range. This interface includes an interactive API-builder UI for constructing queries without writing code.

Documentation URL: https://open-meteo.com/en/docs/google-weathernext-api

Google Developers WeatherNext Guide

The Google Developers WeatherNext Guide aggregates the same data feeds available through Google Cloud, WeatherLab, and OpenMeteo while adding client libraries, usage quotas, authentication details, and example code. This portal serves as the comprehensive developer resource for production integrations.

Documentation URL: https://developers.google.com/weathernext/guides/models

Internal Python API Reference

For developers extending or customizing the model, the repository exposes an xarray-based Predictor API through abstract base classes.

The PredictorBase Abstract Interface

The core Python interface lives in weathernext/utils/predictor_base.py. This file defines the PredictorBase abstract class, which establishes the contract for any predictor accepting an xarray Dataset and returning an xarray Dataset. All demo notebooks and downstream scripts implement this interface to ensure consistent data handling.

Loading Model Checkpoints

Concrete model implementations reside in weathernext/weathernext2/architecture.py. The load_checkpoint utilities in this module enable loading pretrained weights from Google Cloud Storage buckets (referenced in README lines 10-12).

Code Examples for Accessing WeatherNext Data

Querying the OpenMeteo HTTP Endpoint

The following Python snippet demonstrates how to call the public OpenMeteo WeatherNext API endpoint:

import requests

def fetch_weathernext(
    latitude: float,
    longitude: float,
    start_date: str,      # YYYY-MM-DD

    end_date: str,        # YYYY-MM-DD

    variables: str = "temperature_2m,windspeed_10m",
) -> dict:
    """Retrieve WeatherNext forecasts via the OpenMeteo endpoint."""
    url = "https://api.open-meteo.com/v1/weathernext"
    params = {
        "latitude": latitude,
        "longitude": longitude,
        "start_date": start_date,
        "end_date": end_date,
        "hourly": variables,
        "timezone": "UTC",
    }
    resp = requests.get(url, params=params, timeout=30)
    resp.raise_for_status()
    return resp.json()

# Example: forecast temperature & wind for New York City on 2025-01-01

forecast = fetch_weathernext(
    latitude=40.7128,
    longitude=-74.0060,
    start_date="2025-01-01",
    end_date="2025-01-02",
)
print(forecast["hourly"]["temperature_2m"][:5])   # first 5 hourly values

Key implementation details:

  • The endpoint https://api.open-meteo.com/v1/weathernext follows OpenMeteo conventions
  • Parameters include latitude, longitude, start_date, end_date, and hourly
  • The JSON response contains NumPy-compatible arrays in the hourly field

Implementing the xarray Predictor Interface

For internal model access, implement the PredictorBase class:

import xarray as xr
from weathernext.utils.predictor_base import PredictorBase

class MyWeatherPredictor(PredictorBase):
    """Thin wrapper around a pre-loaded WeatherNext model."""
    def __init__(self, model):
        self.model = model

    def __call__(self, inputs: xr.Dataset) -> xr.Dataset:
        # The model expects an xarray Dataset with the same variable names

        # as used in the training data (e.g., "temperature", "wind_10m").

        return self.model.predict(inputs)

# ----------------------------------------------------------------------

# Example usage (the heavy lifting – loading the model and data – is omitted

# for brevity; see the Colab demo notebook for a full end-to-end flow):

# ----------------------------------------------------------------------

# Load a pretrained model checkpoint (weights are hosted on the Google Cloud

# bucket – see README lines 10-12).

# model = weathernext.weathernext2.load_checkpoint("gs://dm_graphcast/...")

# predictor = MyWeatherPredictor(model)

# Build a minimal input Dataset (e.g., HRES initial condition at time 0)

# init_ds = xr.Dataset({"temperature": (...), "wind_10m": (...)})

# forecast_ds = predictor(init_ds)

print(forecast_ds)          # xarray Dataset with forecast fields

This implementation requires:

  • Inheriting from PredictorBase defined in weathernext/utils/predictor_base.py
  • Accepting and returning xarray Dataset objects
  • Loading model weights via weathernext.weathernext2.load_checkpoint

Key Source Files for API Implementation

Understanding these specific files accelerates development:

  • weathernext/utils/predictor_base.py: Defines the public xarray-based Predictor API used by all demos
  • weathernext/weathernext2/architecture.py: Contains the core model architecture (FGN) powering WeatherNext 2
  • docs/weathernext2/wn2_demo.ipynb: Interactive Colab notebook demonstrating end-to-end model loading, forecasting, and visualization
  • README.md (section "Accessing Forecast Data Feeds"): Lists the three public platforms (Google Cloud, WeatherLab, OpenMeteo) exposing WeatherNext data

Summary

  • WeatherNext API documentation is officially hosted on OpenMeteo and Google Developers portals
  • The OpenMeteo endpoint provides simple HTTP/JSON access for location-based forecasts
  • The Google Developers Guide offers comprehensive integration resources including authentication and quotas
  • Internal Python development relies on PredictorBase in weathernext/utils/predictor_base.py
  • The xarray-based interface ensures consistent data handling across the codebase
  • Reference the wn2_demo.ipynb notebook for complete implementation examples

Frequently Asked Questions

Where is the official WeatherNext API documentation hosted?

Official documentation resides in two locations: the OpenMeteo WeatherNext API docs at open-meteo.com/en/docs/google-weathernext-api and the Google Developers WeatherNext Guide at developers.google.com/weathernext/guides/models. Both links are listed in the repository README under the "Accessing Forecast Data Feeds" (lines 19-23) and "Learn More" (lines 26-33) sections.

How do I access WeatherNext forecast data programmatically?

You can query forecast data using the OpenMeteo HTTP endpoint at https://api.open-meteo.com/v1/weathernext with standard HTTP clients, or implement the internal Python API by subclassing PredictorBase from weathernext/utils/predictor_base.py for direct model integration.

What Python class defines the WeatherNext prediction interface?

The PredictorBase abstract class in weathernext/utils/predictor_base.py defines the core interface. It requires implementing a __call__ method that accepts an xarray Dataset and returns an xarray Dataset, standardizing how predictors handle meteorological data.

Is there an interactive demo for the WeatherNext API?

Yes, the repository includes docs/weathernext2/wn2_demo.ipynb, a Colab notebook referenced in README lines 96-99. This notebook demonstrates loading pretrained checkpoints, running autoregressive forecasts, and visualizing results using the PredictorBase interface.

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 →