Skip to content

CBottle Tropical Cyclone Guidance

Guided tropical cyclone sampling with cBottle and odds-ratio diagnostics.

This example demonstrates the cBottle TC guidance model for generating synthetic tropical cyclone samples at user-specified locations and computing the log-odds ratio between the guided and unguided distributions. The odds ratio quantifies how much more likely a particular sample is under guidance compared to the base model.

For more information on cBottle see:

For more information on the odds ratio see:

In this example you will learn:

  • Running guided TC sampling with earth2studio.models.dx.CBottleTCGuidance
  • Visualizing a guided sample over a regional domain
  • Reloading the model with second-order derivative support for odds-ratio computation
  • Computing and interpreting the log-odds ratio of a guided sample

Set Up

For this example we need the cBottle TC guidance diagnostic model. We load it twice:

  1. Default (fast) path for standard guided sampling
  2. Second-order-derivative path for odds-ratio computation

Thus, we need the following:

import os

os.makedirs("outputs", exist_ok=True)
from dotenv import load_dotenv

load_dotenv()  # TODO: make common example prep function

from datetime import datetime

import numpy as np
import torch

from earth2studio.models.dx import CBottleTCGuidance

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# Load the default model package which downloads the checkpoint from NGC
package = CBottleTCGuidance.load_default_package()
Console output9 lines
/__w/earth2studio/earth2studio/.venv/lib/python3.13/site-packages/torch/cuda/__init__.py:64: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
  import pynvml  # type: ignore[import]
WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for:
    PyTorch 2.10.0+cu128 with CUDA 1208 (you have 2.13.0+cu130)
    Python  3.10.19 (you have 3.13.13)
  Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers)
  Memory-efficient attention, SwiGLU, sparse and more won't be available.
  Set XFORMERS_MORE_DETAILS=1 for more details
CuPy distance computation test failed with error: cuVS >= 24.12 or pylibraft < 24.12 should be installed to use this feature

Guided TC Sampling (Fast Path)

The guidance tensor marks the location where we want TC activity. Here we place a single guidance point near Florida and request one timestamp during hurricane season. The fast model path (allow_second_order_derivatives=False) is optimized for standard guided inference.

lat = torch.tensor([27.0], device=device)  # Near Florida
lon = torch.tensor([-82.0], device=device)  # Converted internally to [0, 360)
times = [datetime(2005, 10, 11, 12)]

model = CBottleTCGuidance.load_model(package, seed=0).to(device)
# Create guidance tensor
guidance, coords = model.create_guidance_tensor(lat, lon, times)
guidance = guidance.to(device)
# Run guided sampling
guided_sample, guided_coords = model(guidance, coords)
Console output171 lines
Downloading training-state-002176000.checkpoint: 0%|          | 0.00/1.67G [00:00<?, ?B/s]
Downloading training-state-002176000.checkpoint: 1%|          | 10.0M/1.67G [00:01<03:37, 8.17MB/s]
Downloading training-state-002176000.checkpoint: 1%|          | 20.0M/1.67G [00:01<01:57, 15.1MB/s]
Downloading training-state-002176000.checkpoint: 2%|โ–         | 30.0M/1.67G [00:01<01:16, 23.0MB/s]
Downloading training-state-002176000.checkpoint: 2%|โ–         | 40.0M/1.67G [00:02<01:04, 27.0MB/s]
Downloading training-state-002176000.checkpoint: 3%|โ–Ž         | 50.0M/1.67G [00:02<00:49, 34.9MB/s]
Downloading training-state-002176000.checkpoint: 4%|โ–Ž         | 60.0M/1.67G [00:02<00:44, 38.9MB/s]
Downloading training-state-002176000.checkpoint: 4%|โ–         | 70.0M/1.67G [00:02<00:52, 32.4MB/s]
Downloading training-state-002176000.checkpoint: 5%|โ–         | 80.0M/1.67G [00:02<00:45, 37.7MB/s]
Downloading training-state-002176000.checkpoint: 5%|โ–Œ         | 90.0M/1.67G [00:03<00:38, 43.7MB/s]
Downloading training-state-002176000.checkpoint: 6%|โ–Œ         | 100M/1.67G [00:03<00:35, 47.7MB/s] 
Downloading training-state-002176000.checkpoint: 6%|โ–‹         | 110M/1.67G [00:03<00:33, 49.4MB/s]
Downloading training-state-002176000.checkpoint: 7%|โ–‹         | 120M/1.67G [00:03<00:34, 48.6MB/s]
Downloading training-state-002176000.checkpoint: 8%|โ–Š         | 130M/1.67G [00:04<00:39, 41.4MB/s]
Downloading training-state-002176000.checkpoint: 8%|โ–Š         | 140M/1.67G [00:04<00:37, 44.0MB/s]
Downloading training-state-002176000.checkpoint: 9%|โ–‰         | 150M/1.67G [00:04<00:42, 38.5MB/s]
Downloading training-state-002176000.checkpoint: 9%|โ–‰         | 160M/1.67G [00:04<00:37, 43.2MB/s]
Downloading training-state-002176000.checkpoint: 10%|โ–‰         | 170M/1.67G [00:05<00:43, 37.3MB/s]
Downloading training-state-002176000.checkpoint: 11%|โ–ˆ         | 180M/1.67G [00:05<00:37, 42.5MB/s]
Downloading training-state-002176000.checkpoint: 11%|โ–ˆ         | 190M/1.67G [00:05<00:34, 46.0MB/s]
Downloading training-state-002176000.checkpoint: 12%|โ–ˆโ–        | 200M/1.67G [00:05<00:37, 42.1MB/s]
Downloading training-state-002176000.checkpoint: 12%|โ–ˆโ–        | 210M/1.67G [00:06<00:35, 44.0MB/s]
Downloading training-state-002176000.checkpoint: 13%|โ–ˆโ–Ž        | 220M/1.67G [00:06<00:35, 44.0MB/s]
Downloading training-state-002176000.checkpoint: 13%|โ–ˆโ–Ž        | 230M/1.67G [00:06<00:35, 44.0MB/s]
Downloading training-state-002176000.checkpoint: 14%|โ–ˆโ–        | 240M/1.67G [00:06<00:32, 46.7MB/s]
Downloading training-state-002176000.checkpoint: 15%|โ–ˆโ–        | 250M/1.67G [00:06<00:31, 48.6MB/s]
Downloading training-state-002176000.checkpoint: 15%|โ–ˆโ–Œ        | 260M/1.67G [00:07<00:36, 41.0MB/s]
Downloading training-state-002176000.checkpoint: 16%|โ–ˆโ–Œ        | 270M/1.67G [00:07<00:32, 46.6MB/s]
Downloading training-state-002176000.checkpoint: 16%|โ–ˆโ–‹        | 280M/1.67G [00:07<00:32, 46.1MB/s]
Downloading training-state-002176000.checkpoint: 17%|โ–ˆโ–‹        | 290M/1.67G [00:07<00:28, 51.6MB/s]
Downloading training-state-002176000.checkpoint: 18%|โ–ˆโ–Š        | 300M/1.67G [00:07<00:27, 53.6MB/s]
Downloading training-state-002176000.checkpoint: 18%|โ–ˆโ–Š        | 310M/1.67G [00:08<00:25, 57.7MB/s]
Downloading training-state-002176000.checkpoint: 19%|โ–ˆโ–‰        | 320M/1.67G [00:08<00:31, 45.7MB/s]
Downloading training-state-002176000.checkpoint: 19%|โ–ˆโ–‰        | 330M/1.67G [00:08<00:28, 51.3MB/s]
Downloading training-state-002176000.checkpoint: 20%|โ–ˆโ–‰        | 340M/1.67G [00:08<00:26, 53.5MB/s]
Downloading training-state-002176000.checkpoint: 21%|โ–ˆโ–ˆ        | 350M/1.67G [00:08<00:24, 58.2MB/s]
Downloading training-state-002176000.checkpoint: 21%|โ–ˆโ–ˆ        | 360M/1.67G [00:09<00:24, 56.4MB/s]
Downloading training-state-002176000.checkpoint: 22%|โ–ˆโ–ˆโ–       | 370M/1.67G [00:09<00:22, 63.1MB/s]
Downloading training-state-002176000.checkpoint: 22%|โ–ˆโ–ˆโ–       | 380M/1.67G [00:09<00:27, 49.9MB/s]
Downloading training-state-002176000.checkpoint: 23%|โ–ˆโ–ˆโ–Ž       | 390M/1.67G [00:09<00:31, 44.5MB/s]
Downloading training-state-002176000.checkpoint: 23%|โ–ˆโ–ˆโ–Ž       | 400M/1.67G [00:10<00:29, 46.8MB/s]
Downloading training-state-002176000.checkpoint: 24%|โ–ˆโ–ˆโ–       | 410M/1.67G [00:10<00:28, 47.8MB/s]
Downloading training-state-002176000.checkpoint: 25%|โ–ˆโ–ˆโ–       | 420M/1.67G [00:10<00:25, 52.3MB/s]
Downloading training-state-002176000.checkpoint: 25%|โ–ˆโ–ˆโ–Œ       | 430M/1.67G [00:10<00:24, 54.4MB/s]
Downloading training-state-002176000.checkpoint: 26%|โ–ˆโ–ˆโ–Œ       | 440M/1.67G [00:10<00:22, 58.8MB/s]
Downloading training-state-002176000.checkpoint: 26%|โ–ˆโ–ˆโ–‹       | 450M/1.67G [00:11<00:28, 47.0MB/s]
Downloading training-state-002176000.checkpoint: 27%|โ–ˆโ–ˆโ–‹       | 460M/1.67G [00:11<00:25, 50.9MB/s]
Downloading training-state-002176000.checkpoint: 28%|โ–ˆโ–ˆโ–Š       | 470M/1.67G [00:11<00:23, 54.6MB/s]
Downloading training-state-002176000.checkpoint: 28%|โ–ˆโ–ˆโ–Š       | 480M/1.67G [00:11<00:25, 49.7MB/s]
Downloading training-state-002176000.checkpoint: 29%|โ–ˆโ–ˆโ–Š       | 490M/1.67G [00:11<00:24, 52.0MB/s]
Downloading training-state-002176000.checkpoint: 29%|โ–ˆโ–ˆโ–‰       | 500M/1.67G [00:11<00:23, 54.5MB/s]
Downloading training-state-002176000.checkpoint: 30%|โ–ˆโ–ˆโ–‰       | 510M/1.67G [00:12<00:22, 54.8MB/s]
Downloading training-state-002176000.checkpoint: 30%|โ–ˆโ–ˆโ–ˆ       | 520M/1.67G [00:12<00:29, 41.9MB/s]
Downloading training-state-002176000.checkpoint: 31%|โ–ˆโ–ˆโ–ˆ       | 530M/1.67G [00:12<00:26, 46.6MB/s]
Downloading training-state-002176000.checkpoint: 32%|โ–ˆโ–ˆโ–ˆโ–      | 540M/1.67G [00:12<00:26, 46.3MB/s]
Downloading training-state-002176000.checkpoint: 32%|โ–ˆโ–ˆโ–ˆโ–      | 550M/1.67G [00:13<00:23, 51.3MB/s]
Downloading training-state-002176000.checkpoint: 33%|โ–ˆโ–ˆโ–ˆโ–Ž      | 560M/1.67G [00:13<00:21, 54.6MB/s]
Downloading training-state-002176000.checkpoint: 33%|โ–ˆโ–ˆโ–ˆโ–Ž      | 570M/1.67G [00:13<00:20, 58.5MB/s]
Downloading training-state-002176000.checkpoint: 34%|โ–ˆโ–ˆโ–ˆโ–      | 580M/1.67G [00:13<00:22, 51.8MB/s]
Downloading training-state-002176000.checkpoint: 35%|โ–ˆโ–ˆโ–ˆโ–      | 590M/1.67G [00:13<00:23, 50.6MB/s]
Downloading training-state-002176000.checkpoint: 35%|โ–ˆโ–ˆโ–ˆโ–Œ      | 600M/1.67G [00:14<00:22, 50.6MB/s]
Downloading training-state-002176000.checkpoint: 36%|โ–ˆโ–ˆโ–ˆโ–Œ      | 610M/1.67G [00:14<00:22, 50.1MB/s]
Downloading training-state-002176000.checkpoint: 36%|โ–ˆโ–ˆโ–ˆโ–‹      | 620M/1.67G [00:14<00:20, 54.2MB/s]
Downloading training-state-002176000.checkpoint: 37%|โ–ˆโ–ˆโ–ˆโ–‹      | 630M/1.67G [00:14<00:18, 60.5MB/s]
Downloading training-state-002176000.checkpoint: 38%|โ–ˆโ–ˆโ–ˆโ–Š      | 640M/1.67G [00:14<00:22, 49.8MB/s]
Downloading training-state-002176000.checkpoint: 38%|โ–ˆโ–ˆโ–ˆโ–Š      | 650M/1.67G [00:15<00:20, 53.6MB/s]
Downloading training-state-002176000.checkpoint: 39%|โ–ˆโ–ˆโ–ˆโ–Š      | 660M/1.67G [00:15<00:20, 54.6MB/s]
Downloading training-state-002176000.checkpoint: 39%|โ–ˆโ–ˆโ–ˆโ–‰      | 670M/1.67G [00:15<00:18, 59.4MB/s]
Downloading training-state-002176000.checkpoint: 40%|โ–ˆโ–ˆโ–ˆโ–‰      | 680M/1.67G [00:15<00:18, 59.0MB/s]
Downloading training-state-002176000.checkpoint: 40%|โ–ˆโ–ˆโ–ˆโ–ˆ      | 690M/1.67G [00:15<00:17, 62.0MB/s]
Downloading training-state-002176000.checkpoint: 41%|โ–ˆโ–ˆโ–ˆโ–ˆ      | 700M/1.67G [00:15<00:17, 59.9MB/s]
Downloading training-state-002176000.checkpoint: 42%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 710M/1.67G [00:16<00:20, 52.1MB/s]
Downloading training-state-002176000.checkpoint: 42%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 720M/1.67G [00:16<00:17, 58.4MB/s]
Downloading training-state-002176000.checkpoint: 43%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Ž     | 730M/1.67G [00:16<00:17, 59.0MB/s]
Downloading training-state-002176000.checkpoint: 43%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Ž     | 740M/1.67G [00:16<00:16, 61.1MB/s]
Downloading training-state-002176000.checkpoint: 44%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 750M/1.67G [00:16<00:14, 67.6MB/s]
Downloading training-state-002176000.checkpoint: 45%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 760M/1.67G [00:16<00:13, 72.1MB/s]
Downloading training-state-002176000.checkpoint: 45%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Œ     | 770M/1.67G [00:17<00:15, 64.7MB/s]
Downloading training-state-002176000.checkpoint: 46%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Œ     | 780M/1.67G [00:17<00:13, 70.6MB/s]
Downloading training-state-002176000.checkpoint: 46%|โ–ˆโ–ˆโ–ˆโ–ˆโ–‹     | 790M/1.67G [00:17<00:12, 75.3MB/s]
Downloading training-state-002176000.checkpoint: 47%|โ–ˆโ–ˆโ–ˆโ–ˆโ–‹     | 800M/1.67G [00:17<00:12, 78.4MB/s]
Downloading training-state-002176000.checkpoint: 48%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Š     | 810M/1.67G [00:17<00:11, 81.0MB/s]
Downloading training-state-002176000.checkpoint: 48%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Š     | 820M/1.67G [00:17<00:11, 82.6MB/s]
Downloading training-state-002176000.checkpoint: 49%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Š     | 830M/1.67G [00:17<00:10, 85.5MB/s]
Downloading training-state-002176000.checkpoint: 49%|โ–ˆโ–ˆโ–ˆโ–ˆโ–‰     | 840M/1.67G [00:18<00:14, 64.6MB/s]
Downloading training-state-002176000.checkpoint: 50%|โ–ˆโ–ˆโ–ˆโ–ˆโ–‰     | 850M/1.67G [00:18<00:12, 69.2MB/s]
Downloading training-state-002176000.checkpoint: 50%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ     | 860M/1.67G [00:18<00:12, 71.0MB/s]
Downloading training-state-002176000.checkpoint: 51%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ     | 870M/1.67G [00:18<00:11, 73.7MB/s]
Downloading training-state-002176000.checkpoint: 52%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 880M/1.67G [00:18<00:12, 71.3MB/s]
Downloading training-state-002176000.checkpoint: 52%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 890M/1.67G [00:18<00:11, 74.1MB/s]
Downloading training-state-002176000.checkpoint: 53%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž    | 900M/1.67G [00:19<00:16, 50.2MB/s]
Downloading training-state-002176000.checkpoint: 53%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž    | 910M/1.67G [00:19<00:14, 57.3MB/s]
Downloading training-state-002176000.checkpoint: 54%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 920M/1.67G [00:19<00:12, 63.9MB/s]
Downloading training-state-002176000.checkpoint: 55%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 930M/1.67G [00:19<00:12, 67.7MB/s]
Downloading training-state-002176000.checkpoint: 55%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ    | 940M/1.67G [00:19<00:11, 69.9MB/s]
Downloading training-state-002176000.checkpoint: 56%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ    | 950M/1.67G [00:19<00:10, 73.9MB/s]
Downloading training-state-002176000.checkpoint: 56%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹    | 960M/1.67G [00:19<00:12, 65.0MB/s]
Downloading training-state-002176000.checkpoint: 57%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹    | 970M/1.67G [00:20<00:11, 65.0MB/s]
Downloading training-state-002176000.checkpoint: 57%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹    | 980M/1.67G [00:20<00:11, 65.7MB/s]
Downloading training-state-002176000.checkpoint: 58%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š    | 990M/1.67G [00:20<00:11, 63.7MB/s]
Downloading training-state-002176000.checkpoint: 59%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š    | 0.98G/1.67G [00:20<00:11, 65.8MB/s]
Downloading training-state-002176000.checkpoint: 59%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰    | 0.99G/1.67G [00:20<00:11, 61.4MB/s]
Downloading training-state-002176000.checkpoint: 60%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰    | 1.00G/1.67G [00:20<00:11, 61.8MB/s]
Downloading training-state-002176000.checkpoint: 60%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    | 1.01G/1.67G [00:21<00:14, 48.3MB/s]
Downloading training-state-002176000.checkpoint: 61%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    | 1.02G/1.67G [00:21<00:13, 52.3MB/s]
Downloading training-state-002176000.checkpoint: 62%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–   | 1.03G/1.67G [00:21<00:12, 53.6MB/s]
Downloading training-state-002176000.checkpoint: 62%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–   | 1.04G/1.67G [00:21<00:11, 56.6MB/s]
Downloading training-state-002176000.checkpoint: 63%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž   | 1.04G/1.67G [00:21<00:11, 57.5MB/s]
Downloading training-state-002176000.checkpoint: 63%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž   | 1.05G/1.67G [00:22<00:10, 63.2MB/s]
Downloading training-state-002176000.checkpoint: 64%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–   | 1.06G/1.67G [00:22<00:12, 51.1MB/s]
Downloading training-state-002176000.checkpoint: 65%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–   | 1.07G/1.67G [00:22<00:11, 53.0MB/s]
Downloading training-state-002176000.checkpoint: 65%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ   | 1.08G/1.67G [00:22<00:10, 57.3MB/s]
Downloading training-state-002176000.checkpoint: 66%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ   | 1.09G/1.67G [00:22<00:10, 58.7MB/s]
Downloading training-state-002176000.checkpoint: 66%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹   | 1.10G/1.67G [00:23<00:10, 59.3MB/s]
Downloading training-state-002176000.checkpoint: 67%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹   | 1.11G/1.67G [00:23<00:09, 63.1MB/s]
Downloading training-state-002176000.checkpoint: 67%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹   | 1.12G/1.67G [00:23<00:08, 65.9MB/s]
Downloading training-state-002176000.checkpoint: 68%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š   | 1.13G/1.67G [00:23<00:10, 56.9MB/s]
Downloading training-state-002176000.checkpoint: 69%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š   | 1.14G/1.67G [00:23<00:10, 54.6MB/s]
Downloading training-state-002176000.checkpoint: 69%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰   | 1.15G/1.67G [00:23<00:09, 56.8MB/s]
Downloading training-state-002176000.checkpoint: 70%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰   | 1.16G/1.67G [00:24<00:08, 61.5MB/s]
Downloading training-state-002176000.checkpoint: 70%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ   | 1.17G/1.67G [00:24<00:08, 65.9MB/s]
Downloading training-state-002176000.checkpoint: 71%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ   | 1.18G/1.67G [00:24<00:07, 69.5MB/s]
Downloading training-state-002176000.checkpoint: 72%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–  | 1.19G/1.67G [00:24<00:09, 55.5MB/s]
Downloading training-state-002176000.checkpoint: 72%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–  | 1.20G/1.67G [00:24<00:07, 62.3MB/s]
Downloading training-state-002176000.checkpoint: 73%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž  | 1.21G/1.67G [00:24<00:07, 61.1MB/s]
Downloading training-state-002176000.checkpoint: 73%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž  | 1.22G/1.67G [00:25<00:07, 66.7MB/s]
Downloading training-state-002176000.checkpoint: 74%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–  | 1.23G/1.67G [00:25<00:07, 65.5MB/s]
Downloading training-state-002176000.checkpoint: 74%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–  | 1.24G/1.67G [00:25<00:06, 70.0MB/s]
Downloading training-state-002176000.checkpoint: 75%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ  | 1.25G/1.67G [00:25<00:07, 59.6MB/s]
Downloading training-state-002176000.checkpoint: 76%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ  | 1.26G/1.67G [00:25<00:06, 63.8MB/s]
Downloading training-state-002176000.checkpoint: 76%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ  | 1.27G/1.67G [00:25<00:06, 66.7MB/s]
Downloading training-state-002176000.checkpoint: 77%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹  | 1.28G/1.67G [00:25<00:05, 70.6MB/s]
Downloading training-state-002176000.checkpoint: 77%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹  | 1.29G/1.67G [00:26<00:05, 74.5MB/s]
Downloading training-state-002176000.checkpoint: 78%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š  | 1.30G/1.67G [00:26<00:05, 76.7MB/s]
Downloading training-state-002176000.checkpoint: 79%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š  | 1.31G/1.67G [00:26<00:05, 76.4MB/s]
Downloading training-state-002176000.checkpoint: 79%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰  | 1.32G/1.67G [00:26<00:07, 53.1MB/s]
Downloading training-state-002176000.checkpoint: 80%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰  | 1.33G/1.67G [00:26<00:06, 53.9MB/s]
Downloading training-state-002176000.checkpoint: 80%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  | 1.34G/1.67G [00:27<00:06, 57.1MB/s]
Downloading training-state-002176000.checkpoint: 81%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  | 1.35G/1.67G [00:27<00:05, 59.2MB/s]
Downloading training-state-002176000.checkpoint: 82%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 1.36G/1.67G [00:27<00:05, 62.5MB/s]
Downloading training-state-002176000.checkpoint: 82%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 1.37G/1.67G [00:27<00:05, 63.5MB/s]
Downloading training-state-002176000.checkpoint: 83%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž | 1.38G/1.67G [00:27<00:06, 49.7MB/s]
Downloading training-state-002176000.checkpoint: 83%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž | 1.39G/1.67G [00:27<00:05, 53.8MB/s]
Downloading training-state-002176000.checkpoint: 84%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 1.40G/1.67G [00:28<00:04, 58.1MB/s]
Downloading training-state-002176000.checkpoint: 84%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 1.41G/1.67G [00:28<00:04, 62.6MB/s]
Downloading training-state-002176000.checkpoint: 85%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ | 1.42G/1.67G [00:28<00:04, 56.8MB/s]
Downloading training-state-002176000.checkpoint: 86%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ | 1.43G/1.67G [00:28<00:04, 60.2MB/s]
Downloading training-state-002176000.checkpoint: 86%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ | 1.44G/1.67G [00:28<00:03, 61.9MB/s]
Downloading training-state-002176000.checkpoint: 87%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹ | 1.45G/1.67G [00:29<00:04, 52.5MB/s]
Downloading training-state-002176000.checkpoint: 87%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹ | 1.46G/1.67G [00:29<00:04, 56.2MB/s]
Downloading training-state-002176000.checkpoint: 88%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š | 1.46G/1.67G [00:29<00:03, 59.6MB/s]
Downloading training-state-002176000.checkpoint: 89%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š | 1.47G/1.67G [00:29<00:03, 64.1MB/s]
Downloading training-state-002176000.checkpoint: 89%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰ | 1.48G/1.67G [00:29<00:02, 68.4MB/s]
Downloading training-state-002176000.checkpoint: 90%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰ | 1.49G/1.67G [00:29<00:02, 73.3MB/s]
Downloading training-state-002176000.checkpoint: 90%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ | 1.50G/1.67G [00:30<00:03, 46.3MB/s]
Downloading training-state-002176000.checkpoint: 91%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ | 1.51G/1.67G [00:30<00:03, 48.8MB/s]
Downloading training-state-002176000.checkpoint: 91%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–| 1.52G/1.67G [00:30<00:02, 50.7MB/s]
Downloading training-state-002176000.checkpoint: 92%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–| 1.53G/1.67G [00:30<00:02, 56.1MB/s]
Downloading training-state-002176000.checkpoint: 93%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž| 1.54G/1.67G [00:30<00:02, 49.7MB/s]
Downloading training-state-002176000.checkpoint: 94%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–| 1.56G/1.67G [00:31<00:02, 50.4MB/s]
Downloading training-state-002176000.checkpoint: 94%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–| 1.57G/1.67G [00:31<00:01, 54.7MB/s]
Downloading training-state-002176000.checkpoint: 95%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ| 1.58G/1.67G [00:31<00:01, 61.5MB/s]
Downloading training-state-002176000.checkpoint: 96%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ| 1.59G/1.67G [00:31<00:01, 66.8MB/s]
Downloading training-state-002176000.checkpoint: 96%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ| 1.60G/1.67G [00:32<00:01, 57.9MB/s]
Downloading training-state-002176000.checkpoint: 97%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹| 1.61G/1.67G [00:32<00:00, 65.7MB/s]
Downloading training-state-002176000.checkpoint: 97%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹| 1.62G/1.67G [00:32<00:00, 71.9MB/s]
Downloading training-state-002176000.checkpoint: 98%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š| 1.63G/1.67G [00:32<00:00, 58.9MB/s]
Downloading training-state-002176000.checkpoint: 99%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š| 1.64G/1.67G [00:32<00:00, 60.8MB/s]
Downloading training-state-002176000.checkpoint: 99%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰| 1.65G/1.67G [00:32<00:00, 61.1MB/s]
Downloading training-state-002176000.checkpoint: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰| 1.66G/1.67G [00:32<00:00, 62.2MB/s]
Downloading training-state-002176000.checkpoint: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 1.67G/1.67G [00:33<00:00, 54.1MB/s]

Post Processing Guided Sample

Plot the 10-metre zonal wind (u10m) over a Caribbean domain to visualize the generated tropical cyclone structure.

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.close("all")

variables = guided_coords["variable"]
u_var = "u10m"
u_idx = int(np.where(variables == u_var)[0][0])

# guided_sample dims: [time, lead_time, variable, lat, lon]
u = guided_sample[0, 0, u_idx].detach().cpu().numpy()
lat_coords = guided_coords["lat"]
lon_coords = guided_coords["lon"]

# Caribbean box in 0-360 longitude convention
lon_min, lon_max = 260.0, 300.0  # 100W to 60W
lat_min, lat_max = 15.0, 40.0  # 15N to 40N
lon_mask = (lon_coords >= lon_min) & (lon_coords <= lon_max)
lat_mask = (lat_coords >= lat_min) & (lat_coords <= lat_max)

u_carib = u[np.ix_(lat_mask, lon_mask)]
lat_carib = lat_coords[lat_mask]
lon_carib = lon_coords[lon_mask]
# Convert to -180..180 for plotting
lon_carib_deg = ((lon_carib + 180.0) % 360.0) - 180.0

fig, ax = plt.subplots(subplot_kw={"projection": ccrs.PlateCarree()}, figsize=(8, 4.5))
pcm = ax.pcolormesh(
    lon_carib_deg,
    lat_carib,
    u_carib,
    shading="auto",
    cmap="RdBu_r",
    vmin=-30,
    vmax=30,
    transform=ccrs.PlateCarree(),
)
ax.set_extent([-100.0, -60.0, lat_min, lat_max], crs=ccrs.PlateCarree())
ax.coastlines(resolution="110m", linewidth=0.8)
ax.gridlines(draw_labels=True, linewidth=0.5, alpha=0.5, linestyle="--")
plt.colorbar(pcm, ax=ax, label=f"{u_var} (m/s)", pad=0.08, shrink=0.92)
ax.set_title("Guided TC Sample: 10m Zonal Wind")
plt.tight_layout()
plt.savefig("outputs/05_cbottle_tc_guided_sample.jpg")

Output from CBottle Tropical Cyclone Guidance

Computing the Odds Ratio

The odds ratio requires computing Hutchinson divergence terms that need second-order derivatives through the model. We reload with allow_second_order_derivatives=True for odds ratio calculations.

Note: sampler_steps is also reduced in this section to speed up runtime. Use the default sampler settings for improved quality and more stable odds-ratio values.

model = CBottleTCGuidance.load_model(
    package,
    seed=0,
    sampler_steps=2,
    allow_second_order_derivatives=True,
).to(device)

log_odds_ratio, forward_latents, latent_coords = model.calculate_odds_ratio(
    guidance,
    coords,
)

print(f"Log odds ratio: {log_odds_ratio:.4f}")
print(f"Forward latents shape: {tuple(forward_latents.shape)}")
Console output89 lines
calculate_odds_ratio[forward]:   0%|          | 0/27 [00:00<?, ?it/s]
calculate_odds_ratio[forward]:   4%|โ–Ž         | 1/27 [00:01<00:31,  1.21s/it]
calculate_odds_ratio[forward]:   7%|โ–‹         | 2/27 [00:02<00:29,  1.18s/it]
calculate_odds_ratio[forward]:  11%|โ–ˆ         | 3/27 [00:03<00:28,  1.17s/it]
calculate_odds_ratio[forward]:  15%|โ–ˆโ–        | 4/27 [00:04<00:26,  1.16s/it]
calculate_odds_ratio[forward]:  19%|โ–ˆโ–Š        | 5/27 [00:05<00:25,  1.15s/it]
calculate_odds_ratio[forward]:  22%|โ–ˆโ–ˆโ–       | 6/27 [00:06<00:24,  1.15s/it]
calculate_odds_ratio[forward]:  26%|โ–ˆโ–ˆโ–Œ       | 7/27 [00:08<00:23,  1.15s/it]
calculate_odds_ratio[forward]:  30%|โ–ˆโ–ˆโ–‰       | 8/27 [00:09<00:21,  1.15s/it]
calculate_odds_ratio[forward]:  33%|โ–ˆโ–ˆโ–ˆโ–Ž      | 9/27 [00:10<00:20,  1.15s/it]
calculate_odds_ratio[forward]:  37%|โ–ˆโ–ˆโ–ˆโ–‹      | 10/27 [00:11<00:19,  1.15s/it]
calculate_odds_ratio[forward]:  41%|โ–ˆโ–ˆโ–ˆโ–ˆ      | 11/27 [00:12<00:18,  1.15s/it]
calculate_odds_ratio[forward]:  44%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 12/27 [00:13<00:17,  1.15s/it]
calculate_odds_ratio[forward]:  48%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Š     | 13/27 [00:15<00:16,  1.15s/it]
calculate_odds_ratio[forward]:  52%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 14/27 [00:16<00:15,  1.16s/it]
calculate_odds_ratio[forward]:  56%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ    | 15/27 [00:17<00:13,  1.16s/it]
calculate_odds_ratio[forward]:  59%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰    | 16/27 [00:18<00:12,  1.15s/it]
calculate_odds_ratio[forward]:  63%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž   | 17/27 [00:19<00:11,  1.15s/it]
calculate_odds_ratio[forward]:  67%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹   | 18/27 [00:20<00:10,  1.15s/it]
calculate_odds_ratio[forward]:  70%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ   | 19/27 [00:22<00:10,  1.32s/it]
calculate_odds_ratio[forward]:  74%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–  | 20/27 [00:23<00:08,  1.28s/it]
calculate_odds_ratio[forward]:  78%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š  | 21/27 [00:24<00:07,  1.25s/it]
calculate_odds_ratio[forward]:  81%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 22/27 [00:26<00:06,  1.23s/it]
calculate_odds_ratio[forward]:  85%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ | 23/27 [00:27<00:04,  1.20s/it]
calculate_odds_ratio[forward]:  89%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰ | 24/27 [00:28<00:03,  1.19s/it]
calculate_odds_ratio[forward]:  93%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž| 25/27 [00:29<00:02,  1.18s/it]
calculate_odds_ratio[forward]:  96%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹| 26/27 [00:30<00:01,  1.17s/it]
calculate_odds_ratio[forward]: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 27/27 [00:31<00:00,  1.16s/it]


calculate_odds_ratio[backward]:   0%|          | 0/26 [00:00<?, ?it/s]
calculate_odds_ratio[backward]:   4%|โ–         | 1/26 [00:05<02:24,  5.78s/it]
calculate_odds_ratio[backward]:   8%|โ–Š         | 2/26 [00:11<02:13,  5.55s/it]
calculate_odds_ratio[backward]:  12%|โ–ˆโ–        | 3/26 [00:18<02:30,  6.52s/it]
calculate_odds_ratio[backward]:  15%|โ–ˆโ–Œ        | 4/26 [00:26<02:32,  6.93s/it]
calculate_odds_ratio[backward]:  19%|โ–ˆโ–‰        | 5/26 [00:33<02:29,  7.12s/it]
calculate_odds_ratio[backward]:  23%|โ–ˆโ–ˆโ–Ž       | 6/26 [00:41<02:24,  7.23s/it]
calculate_odds_ratio[backward]:  27%|โ–ˆโ–ˆโ–‹       | 7/26 [00:48<02:18,  7.31s/it]
calculate_odds_ratio[backward]:  31%|โ–ˆโ–ˆโ–ˆ       | 8/26 [00:56<02:12,  7.36s/it]
calculate_odds_ratio[backward]:  35%|โ–ˆโ–ˆโ–ˆโ–      | 9/26 [01:03<02:06,  7.42s/it]
calculate_odds_ratio[backward]:  38%|โ–ˆโ–ˆโ–ˆโ–Š      | 10/26 [01:11<02:01,  7.61s/it]
calculate_odds_ratio[backward]:  42%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 11/26 [01:19<01:53,  7.57s/it]
calculate_odds_ratio[backward]:  46%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Œ     | 12/26 [01:26<01:45,  7.56s/it]
calculate_odds_ratio[backward]:  50%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ     | 13/26 [01:34<01:37,  7.53s/it]
calculate_odds_ratio[backward]:  54%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 14/26 [01:41<01:30,  7.52s/it]
calculate_odds_ratio[backward]:  58%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š    | 15/26 [01:49<01:22,  7.50s/it]
calculate_odds_ratio[backward]:  62%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–   | 16/26 [01:56<01:14,  7.49s/it]
calculate_odds_ratio[backward]:  65%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ   | 17/26 [02:04<01:07,  7.52s/it]
calculate_odds_ratio[backward]:  69%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰   | 18/26 [02:11<01:00,  7.50s/it]
calculate_odds_ratio[backward]:  73%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž  | 19/26 [02:19<00:52,  7.49s/it]
calculate_odds_ratio[backward]:  77%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹  | 20/26 [02:26<00:44,  7.49s/it]
calculate_odds_ratio[backward]:  81%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  | 21/26 [02:34<00:37,  7.48s/it]
calculate_odds_ratio[backward]:  85%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 22/26 [02:41<00:29,  7.46s/it]
calculate_odds_ratio[backward]:  88%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š | 23/26 [02:49<00:22,  7.47s/it]
calculate_odds_ratio[backward]:  92%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–| 24/26 [02:56<00:14,  7.48s/it]
calculate_odds_ratio[backward]:  96%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ| 25/26 [03:04<00:07,  7.47s/it]
calculate_odds_ratio[backward]: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 26/26 [03:10<00:00,  7.03s/it]


calculate_odds_ratio[backward_no_guidance]:   0%|          | 0/26 [00:00<?, ?it/s]
calculate_odds_ratio[backward_no_guidance]:   4%|โ–         | 1/26 [00:04<02:02,  4.91s/it]
calculate_odds_ratio[backward_no_guidance]:   8%|โ–Š         | 2/26 [00:09<01:58,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  12%|โ–ˆโ–        | 3/26 [00:14<01:53,  4.94s/it]
calculate_odds_ratio[backward_no_guidance]:  15%|โ–ˆโ–Œ        | 4/26 [00:19<01:48,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  19%|โ–ˆโ–‰        | 5/26 [00:24<01:43,  4.94s/it]
calculate_odds_ratio[backward_no_guidance]:  23%|โ–ˆโ–ˆโ–Ž       | 6/26 [00:29<01:38,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  27%|โ–ˆโ–ˆโ–‹       | 7/26 [00:34<01:33,  4.94s/it]
calculate_odds_ratio[backward_no_guidance]:  31%|โ–ˆโ–ˆโ–ˆ       | 8/26 [00:39<01:28,  4.94s/it]
calculate_odds_ratio[backward_no_guidance]:  35%|โ–ˆโ–ˆโ–ˆโ–      | 9/26 [00:44<01:23,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  38%|โ–ˆโ–ˆโ–ˆโ–Š      | 10/26 [00:49<01:19,  4.94s/it]
calculate_odds_ratio[backward_no_guidance]:  42%|โ–ˆโ–ˆโ–ˆโ–ˆโ–     | 11/26 [00:54<01:14,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  46%|โ–ˆโ–ˆโ–ˆโ–ˆโ–Œ     | 12/26 [00:59<01:08,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  50%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ     | 13/26 [01:04<01:03,  4.92s/it]
calculate_odds_ratio[backward_no_guidance]:  54%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–    | 14/26 [01:09<00:59,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  58%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š    | 15/26 [01:13<00:54,  4.93s/it]
calculate_odds_ratio[backward_no_guidance]:  62%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–   | 16/26 [01:18<00:49,  4.92s/it]
calculate_odds_ratio[backward_no_guidance]:  65%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ   | 17/26 [01:24<00:45,  5.08s/it]
calculate_odds_ratio[backward_no_guidance]:  69%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‰   | 18/26 [01:29<00:40,  5.03s/it]
calculate_odds_ratio[backward_no_guidance]:  73%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Ž  | 19/26 [01:34<00:35,  5.00s/it]
calculate_odds_ratio[backward_no_guidance]:  77%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‹  | 20/26 [01:39<00:29,  4.98s/it]
calculate_odds_ratio[backward_no_guidance]:  81%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  | 21/26 [01:44<00:24,  4.99s/it]
calculate_odds_ratio[backward_no_guidance]:  85%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ– | 22/26 [01:49<00:19,  4.98s/it]
calculate_odds_ratio[backward_no_guidance]:  88%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š | 23/26 [01:54<00:14,  4.97s/it]
calculate_odds_ratio[backward_no_guidance]:  92%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–| 24/26 [01:58<00:09,  4.96s/it]
calculate_odds_ratio[backward_no_guidance]:  96%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Œ| 25/26 [02:03<00:04,  4.95s/it]
calculate_odds_ratio[backward_no_guidance]: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 26/26 [02:08<00:00,  4.95s/it]

Log odds ratio: 0.9749
Forward latents shape: (1, 45, 721, 1440)

Post Processing Forward Latents

The forward_latents tensor is returned on the same grid as the model output (lat-lon when lat_lon=True). We visualize a single channel (u10m) over the same Caribbean domain. This shows the latent-space representation that the odds-ratio computation operates on.

plt.close("all")

# Identify the u10m channel in output variable ordering
latent_variables = latent_coords["variable"]
u_latent_idx = int(np.where(latent_variables == u_var)[0][0])
latent_u = forward_latents[0, u_latent_idx].detach().cpu().numpy()

latent_u_carib = latent_u[np.ix_(lat_mask, lon_mask)]

fig, ax = plt.subplots(subplot_kw={"projection": ccrs.PlateCarree()}, figsize=(8, 4.5))
pcm = ax.pcolormesh(
    lon_carib_deg,
    lat_carib,
    latent_u_carib,
    shading="auto",
    cmap="viridis",
    transform=ccrs.PlateCarree(),
)
ax.set_extent([-100.0, -60.0, lat_min, lat_max], crs=ccrs.PlateCarree())
ax.coastlines(resolution="110m", linewidth=0.8)
ax.gridlines(draw_labels=True, linewidth=0.5, alpha=0.5, linestyle="--")
plt.colorbar(pcm, ax=ax, label=f"Forward Latent ({u_var})", pad=0.08, shrink=0.92)
ax.set_title(f"Forward Latents: {u_var} Channel")
plt.tight_layout()
plt.savefig("outputs/05_cbottle_tc_forward_latents.jpg")

Output from CBottle Tropical Cyclone Guidance


Execution profile

Runtime telemetry

Total runtime7m 22s

Execution environment

CPUAMD EPYC 7313P 16-Core Processor
GPUNVIDIA H100 PCIe ยท 79.6 GiB
System RAM58.5 GiB
PlatformLinux 6.8.0-136-generic
Python3.13.13
GPU driver / CUDADriver 595.84 ยท CUDA support 13.2