DEV Community

Nicholas
Nicholas

Posted on • Edited on

GeoAI in Earth Engine: How AI-Powered Weather Forecasting Transforms Energy Operations and Demand Prediction

Introduction

Geospatial AI — represents a new class of machine learning models that are natively trained on Earth observation data: satellite imagery, atmospheric measurements, terrain models, and gridded climate datasets. Unlike traditional ML pipelines that treat location as just another feature column, GeoAI models embed spatial and temporal relationships directly into their architecture.

This article explores what DeepMind's GeoAI models can do by walking through a real end-to-end project: using Google's WeatherNext 2.0 numerical weather prediction model, accessed via Google Earth Engine (GEE), to forecast energy demand for Nairobi, Kenya. The project fuses satellite-derived temperature forecasts with ground-truth weather observations and historical energy consumption data, ultimately producing actionable 7- to 21-day energy demand forecasts — as well as climate scenario simulations. It's a use case example extracted from advanced AI-based weather forecasting model article shared by Yossi Matias.

The result is a working blueprint for how utilities, grid operators, and energy planners across the Global South can use freely available GeoAI infrastructure to make smarter, data-driven decisions.

What is WeatherNext and Why Does it Matter?

WeatherNext 2.0 (projects/gcp-public-data-weathernext/assets/weathernext_2_0_0) is Google's next-generation numerical weather prediction (NWP) model, hosted as a public dataset on Google Earth Engine. It provides global ensemble forecasts — probabilistic outputs from multiple model runs — at sub-daily temporal resolution.

Key characteristics that make it a GeoAI model rather than a conventional NWP system:

  • Ensemble members: Multiple forecast trajectories allow uncertainty quantification, not just point estimates
  • Earth Engine integration: The model outputs are natively queryable as ImageCollection objects, meaning spatial operations (clipping to a region, zonal statistics) are first-class citizens
  • Cloud-native access: No downloading of large GRIB files; computation runs server-side on Google's infrastructure
  • Global coverage at local precision: A bounding box query over Nairobi's coordinates ([36.65, -1.5, 37.1, -1.1]) returns spatially relevant forecasts immediately

For this project, we queried ensemble member 8, with a 6-hour forecast horizon, over the Nairobi region for April 2025 — extracting the 2m_temperature band as our primary variable.

Project Architecture: A Five-Stage Pipeline

The project follows a clean, modular pipeline that any GeoAI practitioner can adapt. Here is the high-level flow:

GEE (WeatherNext) → Daily Aggregation → Validation & Harmonization → Energy Fusion → Demand Forecasting

Stage 1 — Satellite Data Extraction via Google Earth Engine

The first step is querying WeatherNext through the Earth Engine Python API. After authentication and initialization (ee.Authenticate(), ee.Initialize()), the notebook builds a daily temperature time series for Nairobi:

dataset = (
    ee.ImageCollection('projects/gcp-public-data-weathernext/assets/weathernext_2_0_0')
    .filter(ee.Filter.date('2025-04-01T00:00:00Z', '2025-04-30T23:59:59Z'))
    .filter(ee.Filter.eq('ensemble_member', '8'))
    .filter(ee.Filter.eq('forecast_hour', 6))
    .filterBounds(nairobi)
)
Enter fullscreen mode Exit fullscreen mode

Daily aggregation is handled by a custom function that steps through each date, computes a spatial mean over the Nairobi polygon using ee.Reducer.mean() at 1 km scale, and exports the result to a Pandas DataFrame. The raw temperature values come in Kelvin and are converted to Celsius (and optionally Fahrenheit) for analysis.

Why this matters for GeoAI: The entire spatial aggregation — what would traditionally require downloading gigabytes of raster data — runs in seconds server-side. Earth Engine's distributed compute infrastructure is what makes this scale.

Stage 2 — Ground Truth Validation

Satellite model outputs are predictions, not measurements. The project introduces a critical validation step by loading observed temperature data from the Visual Crossing Weather API (sourced via Kaggle), representing actual ground-level conditions in Nairobi for the same April 2025 period.

A direct comparison plot overlays:

  • Model Predicted Temperature (°F) — from WeatherNext via GEE
  • Validation Data Temperature (°F) — from ground weather stations

This visualization immediately surfaces the gap that all remote-sensing practitioners know well: model predictions and ground observations diverge, sometimes significantly. The question is how to close that gap in a principled way. The image below shows the comparison trend of temp foundation model and ground station data

Stage 3 — Bayesian Kriging for Data Harmonization

This is the most technically sophisticated stage of the project and a signature capability of GeoAI-aware workflows. Rather than simply averaging the satellite and ground data, the notebook implements a Bayesian Kriging approach using Gaussian Process Regression (GPR).

Kriging originates in geostatistics as an optimal spatial interpolation technique. Applied here in a temporal and multi-source context, it allows the model to:

  1. Learn the statistical relationship between time, satellite-predicted temperature, and observed temperature
  2. Produce a harmonized temperature estimate that corrects for model bias while quantifying uncertainty
  3. Output a 95% confidence interval around each daily estimate

The kernel used is a product of a Constant kernel and a Radial Basis Function (RBF) kernel — a standard choice for smooth time series:

kernel = C(1.0, (1e-3, 1e3)) * RBF(10, (1e-2, 1e2))
gp = GaussianProcessRegressor(kernel=kernel, alpha=0.1**2, n_restarts_optimizer=10)
Enter fullscreen mode Exit fullscreen mode

The GPR is trained on (date_numeric, model_prediction) → validation_temperature, meaning the satellite forecast acts as a spatial covariate in the kriging system — a technique directly analogous to co-kriging in classical geostatistics. The harmonized output is then used as the primary temperature signal for all downstream tasks.

Why this matters for GeoAI: Data fusion across heterogeneous sources (satellite + in-situ) with uncertainty quantification is a core challenge in operational geospatial analytics. This Bayesian approach produces not just a "best estimate" but a probability distribution — essential for risk-aware decision-making in energy planning. After data fusion using the Bayesian Kriging technique.

Stage 4 — Energy Demand Fusion

The harmonized temperature data alone is insufficient for energy forecasting. The notebook introduces a second data source: American Electric Power (AEP) hourly energy consumption data (April 2006, year-shifted to 2025 for temporal alignment), representing grid-scale electricity demand in megawatts.

The two datasets are merged on a common date key, producing a unified DataFrame with columns:

harmonized_temp — the Bayesian-corrected temperature (°F)
AEP_MW — daily energy consumption (megawatts)

This fusion step is where the project connects weather intelligence to a tangible business outcome. The rationale is well-established: temperature is one of the strongest predictors of electricity demand, driven by heating and cooling loads.

Stage 5 — LSTM-Based Multi-Step Forecasting

With the fused dataset in hand, the project trains a Long Short-Term Memory (LSTM) neural network for multi-step-ahead energy demand forecasting. LSTMs are well-suited to this task because energy demand exhibits strong temporal autocorrelation — today's demand is highly predictive of tomorrow's.

The architecture is deliberately lean:

model = Sequential([
    LSTM(units=50, activation='relu', input_shape=(sequence_length, n_features)),
    Dense(units=1)
])
Enter fullscreen mode Exit fullscreen mode

The predict_energy_demand_lstm() function implements autoregressive multi-step forecasting: each predicted value feeds back into the input sequence for the next step. The project produces forecasts at three horizons:

7 days ahead — operational planning
14 days ahead — medium-term scheduling
21 days ahead — strategic procurement

The output is plotted against the April 2025 actual demand, with the forecast curves extending into May 2025.

Scaling to National Level: County-by-Coaunty Analysis

I decided to extend beyond a single city and included a second analytical thread integrates two additional GEE datasets:

WorldPop (WorldPop/GP/100m/pop) — 100m gridded population counts for 2020
NOAA VIIRS Night Lights (NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG) — a well-established proxy for economic activity (GDP proxy)

These are extracted at county level across Kenya, alongside temperature and rainfall data, to construct a multi-feature dataset where each row represents one county × one time period with attributes: temp, rain, population, gdp_proxy, energy_demand.

A trained LSTM on this county-level data enables:

  1. County-level demand ranking — identifying the top 10 highest energy-consuming counties by average demand

  2. Driver analysis — computing the correlation between each feature and energy demand, answering: Is it temperature, population density, or economic activity that drives demand most?

  3. County-specific multi-day forecasting — generating a table of 7/14/21-day demand predictions for any named county (e.g., Nairobi) with a single function call

Climate Scenario Simulation: The "What If" Capability

Perhaps the most strategically powerful section of the project is the climate impact simulation. The trained model is used to answer: What happens to energy demand if temperatures rise or fall by 2°C?

Two scenarios are modeled for Nairobi over a 7-day forward window:

−2°C scenario: Normalizes the temperature feature downward and re-runs inference
+2°C scenario: Normalizes the temperature feature upward and re-runs inference

The result is a side-by-side comparison of baseline demand versus temperature-shifted demand, quantified as a normalized difference. This kind of scenario analysis is directly applicable to:

Grid resilience planning — anticipating demand spikes during heat waves
Carbon budgeting — modeling how climate change will affect national electricity consumption over the coming decade
Tariff setting — providing evidence for utilities when pricing future energy contracts

In the Kenyan context, where 1 MWh costs approximately KSh 25,000–30,000 (~$190–$230), even a modest increase in demand forecasting accuracy translates to significant financial savings for grid operators.

For this project, I would conclude that WeatherNext2 project demonstrates that GeoAI has moved beyond academic experimentation into a practical, deployable toolkit for real-world applications and leads to the realization of value for Geospatial AI foundation models. The key insight is that satellite-derived weather forecasts are most powerful not as standalone outputs, but as inputs into higher-order models — when fused with ground observations, socioeconomic data, and domain-specific consumption records.

The Bayesian Kriging step, in particular, illustrates a maturity in how practitioners are now thinking about remote sensing data: not as ground truth, but as one signal among many, to be harmonized rather than trusted blindly. The confidence intervals this approach produces are not a weakness to hide — they are decision-relevant information.

For energy planners, utilities, and climate adaptation teams across Sub-Saharan Africa and beyond, this pipeline offers a replicable, scalable blueprint. The data sources used — WeatherNext, WorldPop, VIIRS — are all freely accessible. The computational infrastructure (Google Earth Engine, TensorFlow) is available to researchers at no cost. The only remaining ingredient is domain expertise to translate forecast outputs into operational decisions. Thanks to The WeatherNext team, and Ben for giving access to WeatherNext 2 data.

Interested in learning more, you join our Earth Engine community GDG for Earth Engine

Top comments (0)