Running an AI Weather Model: SFNO Forecast#
This tutorial runs a real AI weather model end-to-end with DFM. We use the SFNO (Spherical Fourier Neural Operator) adapter from nv-dfm-lib-weather to produce a short global forecast, then reuse the xarray transform/render operations from the earlier notebooks to visualize it.
The pipeline we build:
Load an initial condition from GFS analysis (
LoadGfsEra5Data) with the full set of input variables SFNO needs.Unroll a forecast with
SfnoPrognostic, stepping the atmosphere forward in time.Convert the forecast fields to 8-bit images (
ConvertToUint8).Render one image per forecast step (
RenderUint8ToImages).Yield the images back to us.
It builds on the Basic Pipeline and Loaders and Transforms notebooks.
Prerequisites#
Unlike the earlier weather notebooks, SFNO is a GPU-accelerated AI model, so this tutorial needs more than the base install.
Hardware / system: an NVIDIA GPU with the driver and CUDA toolkit installed. See the Installation guide (the “AI Model Adapters” section) for the exact system prerequisites.
Python environment: install the AI model extras, for example from source at the repository root:
uv sync --all-packages --extra tutorials --extra sfno
source .venv/bin/activate
(or replace --extra sfno with --extra all for SFNO + cBottle). Keep --extra tutorials to preserve the earlier notebooks’ dependencies. uv sync can remove a separately installed JupyterLab; reinstall it with uv pip install jupyterlab if needed, then launch it with uv run --no-sync jupyter lab. Select this checkout’s .venv kernel and restart it after changing dependencies. With pip, install nv-dfm-lib-weather[sfno] plus the PyTorch / Earth2Studio model dependencies described in the installation guide.
Federation configuration and generated code (run once from the repository root, as in the Basic Pipeline notebook):
dfm fed config set weather_fed \
--federation-dir tutorials/weather-fed/weather_fed \
--config-path configs/federation.dfm.yaml \
--project-path configs/project.yaml
dfm fed gen code weather_fed
The first SFNO run also downloads the model weights and a GFS analysis file, so it can take several minutes; subsequent runs are faster thanks to caching.
Note: This notebook will not run on a machine without a GPU and the AI extras installed. The rest of the notebooks in this folder do not require a GPU.
# DFM API + weather operations (imported explicitly for the linter)
from helpers.imports import (
Pipeline,
Yield,
Session,
LoadGfsEra5Data,
SfnoPrognostic,
ConvertToUint8,
RenderUint8ToImages,
)
# helper that wires up the yield/status/discovery callbacks for us
from helpers.pipeline_helper import PipelineHelper
# helper to turn yielded TextureFileList results into PIL images
from helpers.image_helper import texturefilelist_to_images
# the federation runtime, used to create a session
import weather_fed.fed.runtime.homesite
from IPython.display import display
Step 1: Build the forecast pipeline#
The pipeline chains four operations. A few things worth highlighting:
LoadGfsEra5Data(variables=["*"], ...)— SFNO expects a specific, complete set of input atmospheric variables. The simplest way to guarantee they are all present is to request everything with["*"]. Theselectionpicks a single analysis time;"mode": "aws"fetches the GFS analysis from the public AWS bucket.SfnoPrognostic(dataset=..., n_steps=..., device="cuda")— starts from the loaded state and unrolls the forecast. Each step advances the atmosphere by ~6 hours, and the output containsn_steps + 1timesteps (the initial condition plus each forecast step). SFNO runs on the GPU, sodevice="cuda".ConvertToUint8/RenderUint8ToImages— the same transform/render operations from the earlier notebooks. Note the SFNO output useslon/latcoordinate names (hencexydims=["lon", "lat"]), and we visualizetcwv(total column water vapour).
# --- forecast configuration -------------------------------------------------
date = "2022-09-05" # initial-condition date (GFS analysis)
n_steps = 4 # number of ~6h steps to unroll -> n_steps + 1 = 5 frames (~24h)
seed = 1337 # RNG seed for reproducibility
device = "cuda" # SFNO requires a GPU
variable = "tcwv" # the forecast variable we will visualize (total column water vapour)
# ---------------------------------------------------------------------------
with Pipeline() as pipeline:
# 1. Load a global initial condition with all variables SFNO needs.
initial_state = LoadGfsEra5Data(
variables=["*"],
selection={"time": date, "mode": "aws"},
)
# 2. Unroll the SFNO forecast from that initial condition.
forecast = SfnoPrognostic(
dataset=initial_state,
n_steps=n_steps,
seed=seed,
device=device,
)
# 3. Convert the forecast fields to 8-bit values (0-255).
converted = ConvertToUint8(
data=forecast,
time_dimension="time",
xydims=["lon", "lat"],
min_value=0.0,
max_value=90.0,
)
# 4. Render one PNG per forecast step for our chosen variable.
rendered = RenderUint8ToImages(
data=converted,
variable=variable,
xydims=["lon", "lat"],
time_dimension="time",
format="PNG",
)
# 5. Send the rendered images back to us.
Yield(value=rendered)
Step 2: Run the pipeline#
We run the pipeline on this machine using local worker processes. PipelineHelper prepares the pipeline and registers the yield/status/discovery callbacks, then run blocks until the job finishes (raising if it fails or reports errors).
Because SFNO downloads model weights on first use and runs inference on the GPU, we give it a generous timeout. This pipeline has no PlaceParams, so input_params is empty.
# create a local session (execution uses worker processes on this machine)
session = weather_fed.fed.runtime.homesite.get_session(target="local")
session.connect()
# prepare and run the pipeline
helper = PipelineHelper(session)
helper.prepare(pipeline)
helper.run(input_params={}, timeout_s=900.0)
# the rendered images arrive on the "yield" place
results = helper.callback_results["yield"]
print(f"received {len(results)} yield message(s)")
2026-08-21 08:29:46.133 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 157052930-911187
2026-08-21 08:29:46.136 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 421566629-1222453
2026-08-21 08:29:46.139 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 414702260-951231
2026-08-21 08:29:46.141 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 222383818-637667
2026-08-21 08:29:46.144 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 301344918-773273
2026-08-21 08:29:46.146 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 186380169-934472
2026-08-21 08:29:46.148 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 175406929-1026820
2026-08-21 08:29:46.150 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 152699454-747284
2026-08-21 08:29:46.151 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 363029483-583407
2026-08-21 08:29:46.153 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 173184814-758624
2026-08-21 08:29:46.155 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 412385784-786703
2026-08-21 08:29:46.156 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 340285509-587261
2026-08-21 08:29:46.158 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 389797240-863531
2026-08-21 08:29:46.159 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 173943438-779668
2026-08-21 08:29:46.161 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 306989884-548419
2026-08-21 08:29:46.162 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 152046750-652704
2026-08-21 08:29:46.164 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 258327406-745931
2026-08-21 08:29:46.166 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 357456360-855808
2026-08-21 08:29:46.167 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 390660771-807009
2026-08-21 08:29:46.169 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 395766739-959789
2026-08-21 08:29:46.170 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 153732462-1004568
2026-08-21 08:29:46.172 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 153446738-285438
2026-08-21 08:29:46.173 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 280232329-823025
2026-08-21 08:29:46.175 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 200033158-593909
2026-08-21 08:29:46.176 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 339710913-574596
2026-08-21 08:29:46.178 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 194315201-748072
2026-08-21 08:29:46.179 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 216264949-765514
2026-08-21 08:29:46.180 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 394793399-973340
2026-08-21 08:29:46.181 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 300472562-872356
2026-08-21 08:29:46.182 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 237629921-743668
2026-08-21 08:29:46.183 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 391658393-1242159
2026-08-21 08:29:46.184 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 243678971-603755
2026-08-21 08:29:46.185 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 236910022-719899
2026-08-21 08:29:46.186 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 263752180-560977
2026-08-21 08:29:46.187 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 185537280-634843
2026-08-21 08:29:46.188 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 413727134-975126
2026-08-21 08:29:46.188 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 189371932-990889
2026-08-21 08:29:46.189 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 362458377-571106
2026-08-21 08:29:46.190 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 302118191-830364
2026-08-21 08:29:46.191 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 459275627-986696
2026-08-21 08:29:46.192 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 336022407-1261583
2026-08-21 08:29:46.193 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 279477629-754700
2026-08-21 08:29:46.194 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 195830234-748155
2026-08-21 08:29:46.195 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 285980911-927796
2026-08-21 08:29:46.196 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 334665855-876513
2026-08-21 08:29:46.198 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 260305012-1181576
2026-08-21 08:29:46.199 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 402287592-839881
2026-08-21 08:29:46.199 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 264313157-567685
2026-08-21 08:29:46.200 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 285052288-928623
2026-08-21 08:29:46.201 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 211373269-615990
2026-08-21 08:29:46.201 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 410127991-508983
2026-08-21 08:29:46.202 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 332895127-910127
2026-08-21 08:29:46.202 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 200627067-592605
2026-08-21 08:29:46.203 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 195063273-766961
2026-08-21 08:29:46.204 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 184023183-755524
2026-08-21 08:29:46.204 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 257620659-706747
2026-08-21 08:29:46.205 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 218372514-1099408
2026-08-21 08:29:46.205 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 355640261-949821
2026-08-21 08:29:46.206 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 217030463-855080
2026-08-21 08:29:46.206 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 259073337-818409
2026-08-21 08:29:46.207 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 206203542-828677
2026-08-21 08:29:46.208 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 207505278-1040405
2026-08-21 08:29:46.208 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 243088097-590874
2026-08-21 08:29:46.209 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 179860540-907455
2026-08-21 08:29:46.209 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 400195491-1006671
2026-08-21 08:29:46.210 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 307538303-552370
2026-08-21 08:29:46.210 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 196928619-962888
2026-08-21 08:29:46.211 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 239629642-1175381
2026-08-21 08:29:46.212 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 460262323-972074
2026-08-21 08:29:46.212 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 0-1006758
2026-08-21 08:29:46.213 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 205446749-756793
2026-08-21 08:29:46.213 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 238373589-827890
2026-08-21 08:29:46.214 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 215530521-734428
2026-08-21 08:29:46.214 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 210765991-607278
2026-08-21 08:29:46.215 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 278654508-823121
2026-08-21 08:29:46.216 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 281428802-1230852
2026-08-21 08:29:46.216 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 174723106-541901
2026-08-21 08:29:46.217 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 358838020-1257748
2026-08-21 08:29:46.217 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 221761550-622268
2026-08-21 08:29:46.218 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 190362821-930767
2026-08-21 08:29:46.218 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 303289132-1295593
2026-08-21 08:29:46.219 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 333805254-860601
2026-08-21 08:29:46.220 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 178890938-969602
2026-08-21 08:29:46.220 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 204702767-743982
2026-08-21 08:29:46.221 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 157964117-835399
2026-08-21 08:29:46.221 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 356590082-866278
2026-08-21 08:29:46.222 | DEBUG | earth2studio.data.gfs:fetch_array:369 - Fetching GFS grib file: noaa-gfs-bdp-pds/gfs.20220905/00/atmos/gfs.t00z.pgrb2.0p25.f000 184778707-758573
received 1 yield message(s)
Step 3: View the forecast#
Each yielded message is a TextureFileList containing one image per forecast timestep. We decode them to PIL images and display them in order — the first frame is the initial condition and each subsequent frame is ~6 hours later, so you can watch the tcwv field evolve across the forecast.
for message in results:
images = texturefilelist_to_images(message)
for texture_file, image in zip(message.texture_files, images):
print(texture_file.timestamp)
display(image)
2022-09-05T00:00
2022-09-05T06:00
2022-09-05T12:00
2022-09-05T18:00
2022-09-06T00:00
Customizing the forecast#
Try changing the configuration in Step 1 and re-running Steps 1-3:
Longer lead time: increase
n_steps(e.g.n_steps=20for a ~5-day forecast). You will get more frames, and the run will take longer.A different variable: change
variableto another field produced by SFNO, and adjustmin_value/max_valueinConvertToUint8to a sensible range for that field (the render step normalizes values into 0-255 using this range).A different initial date: change
dateto another GFS analysis date.
You can also run the SFNO operation on a specific site in a distributed federation by passing site=... to the operations, exactly as shown for the Flare target in the Basic Pipeline notebook.
Step 4: Cleanup#
Close the session to release resources. In local mode this stops the background threads, queues, and any child processes started for execution; leaving sessions open can leak these across repeated runs in a long-lived kernel.
session.close()
Recap#
You just ran a full AI weather forecast through DFM: loading a global initial condition, unrolling an SFNO forecast on the GPU, and rendering the result — all as a single DFM pipeline. The same pattern applies to the other AI model adapters in nv-dfm-lib-weather (for example the cBottle operations), which plug into pipelines the same way.