CoolFace
Modelpublic

jeffliulab/weather-forecasting-v1

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
Model Card

Weather Forecasting Models — Tufts CS137

Deep learning models for 24-hour weather prediction at Tufts University (Jumbo Statue, Medford MA), trained on NOAA HRRR 3 km reanalysis data.

6 architectures trained and compared: CNN Baseline, ResNet-18, ConvNeXt-Tiny, Multi-frame CNN, 3D CNN, and Vision Transformer (ViT).

Models

ModelFileParamsArchitectureTMP RMSE (K)Rain AUC
WeatherViTvit/best.pt7.4M6-layer Transformer, 15×15 patches, 900 tokens4.060.776
ResNet-18checkpoints/resnet18.pt11.2MModified torchvision ResNet-183.540.768
CNN Baselinecheckpoints/cnn_baseline.pt11.3M6 ResBlocks, progressive downsample4.000.738

Full Test Results (2021)

ModelTMP (K)RH (%)UGRD (m/s)VGRD (m/s)GUST (m/s)APCP>2mm (mm)AUC
ViT4.0616.452.592.213.574.500.776
ResNet-183.5415.682.702.343.604.530.768
CNN Baseline4.0015.892.562.233.584.560.738
ConvNeXt-Tiny3.6615.852.542.173.654.550.692
CNN 3D4.7617.442.612.323.584.750.668
Multi-frame CNN4.5518.412.622.453.624.760.652
Persistence4.8623.013.732.894.874.620.506

Key findings:

  • ViT achieves the best rain detection AUC (0.776), precipitation RMSE, wind gust, and V-wind
  • ResNet-18 leads in temperature (3.54 K) and humidity (15.68%) accuracy
  • All models significantly outperform the persistence baseline

Input

  • Format: 42-channel spatial grid (450 × 449 pixels)
  • Resolution: 3 km (HRRR Lambert Conformal projection)
  • Region: US Northeast / New England (~1350 km × 1350 km)
  • Channels: Surface variables (temperature, humidity, wind, precipitation, radiation) + atmospheric variables at multiple pressure levels (CAPE, dew point, geopotential height, temperature, U/V wind, cloud cover, moisture)

Output

6 continuous values predicted 24 hours ahead at a single target point:

VariableUnit
2m TemperatureK
2m Relative Humidity%
10m U-Windm/s
10m V-Windm/s
Surface Gustm/s
1hr Precipitationmm

Architecture Highlights

WeatherViT (new)

Input (B,42,450,449) → pad→450×450 → PatchEmbed(15×15, 900 patches)
  → [CLS]+PosEmbed → 6×TransformerBlock(8 heads, dim=256) → CLS → FC → (B,6)

CNN Baseline

Input (B,42,450,449) → Stem(42→64, 7×7, s=2) → 6×ResBlock → GAP → FC → (B,6)

ResNet-18

Input (B,42,450,449) → Modified torchvision ResNet-18 (42-ch input) → FC → (B,6)

Checkpoint Format

python
{
    "model": state_dict,          # Model weights
    "norm_stats": {               # Z-score normalization statistics
        "input_mean": (42, 1, 1),
        "input_std": (42, 1, 1),
        "target_mean": (6,),
        "target_std": (6,),
    },
    "args": {...},                # Training hyperparameters
}

Usage

python
import torch
from models import create_model

# Load any model (cnn_baseline, resnet18, vit, convnext_tiny, cnn_3d, cnn_multi_frame)
ckpt = torch.load("vit/best.pt", map_location="cpu", weights_only=False)
model = create_model(ckpt["args"]["model"], n_input_channels=42, n_targets=6)
model.load_state_dict(ckpt["model"])
model.eval()

# Inference
x = torch.randn(1, 42, 450, 449)  # (batch, channels, height, width)
norm = ckpt["norm_stats"]
x = (x - norm["input_mean"]) / (norm["input_std"] + 1e-7)
with torch.no_grad():
    pred = model(x)  # (1, 6)
pred = pred * norm["target_std"] + norm["target_mean"]  # denormalize

Training Data

HRRR (High-Resolution Rapid Refresh) — NOAA's 3 km hourly weather analysis.

SplitPeriodSamples
Training2018–2019~17,500
Validation2020~8,700
Test2021~8,700

Live Demo

Try the models in real-time with live HRRR data: [Tufts Weather Forecast Space](https://huggingface.co/spaces/jeffliulab/weather_predict)

The demo fetches real-time HRRR analysis from NOAA, runs inference, and displays:

  • Current input field maps (temperature, precipitation, wind, humidity)
  • 24-hour forecast at the Jumbo Statue target point

Links