Skip to content

Add DLWP (Deep Learning Weather Prediction) for Weather Forecasting#35

Open
cristian-victoria wants to merge 11 commits intoLabRAI:mainfrom
cristian-victoria:dlwp
Open

Add DLWP (Deep Learning Weather Prediction) for Weather Forecasting#35
cristian-victoria wants to merge 11 commits intoLabRAI:mainfrom
cristian-victoria:dlwp

Conversation

@cristian-victoria
Copy link
Copy Markdown

This PR implements DLWP, a U-Net-based model for global weather forecasting on cubed-sphere grids, as described in Weyn et al. (2020, 2021).

Reference:

Weyn et al. (2021) - Sub-Seasonal Forecasting
Weyn et al. (2020) - Cubed Sphere CNNs

Changes

New Files

  • pyhazards/models/dlwp.py - Core implementation
    • DLWP class - U-Net architecture
    • dlwp_builder() - builder function
    • DoubleConv, Down, Up - blocks
    • WeatherMetrics class - RMSE, ACC, Bias metrics
  • docs/source/modules/models_dlwp.rst - Full documentation

Modified Files

  • pyhazards/models/__init__.py - Added imports and registration
  • docs/source/pyhazards_models.rst - Added model to index

Smoke Testing

Results:

Test 1: Model Registration
Test 2: Forward Pass
Test 3: Shape Validation
Test 4: Training Loop
Test 5: Gradient Flow
Test 6: Loss and Metrics
Test 7: Save and Load
Total: 7/7 tests passed

Paper Parity Note

This implementation follows the WaveCastNet paper with these intentional differences:

Identical to Paper

  • Architecture:

    • U-Net encoder-decoder with skip connections
    • DoubleConv blocks (Conv → BN → Act × 2)
    • MaxPool downsampling, ConvTranspose upsampling
    • Channel doubling at each level
  • Data Format:

    • Cubed-sphere grid: (batch, channels, 6_faces, height, width)
    • Single-step prediction: u(t) → u(t+6hr)
    • Autoregressive multi-step forecasting
  • Training & Evaluation:

    • MSE loss function
    • RMSE, ACC, Bias metrics

PyHazards-Specific Adaptations

  • Training loop: Uses Trainer.fit() instead of custom loops
  • Data format: Uses DataBundle wrapper
  • Face processing: Reshapes (B,C,F,H,W) → (B*F,C,H,W) for Conv2d

Future Work

  • Mixed precision training (can add via torch.cuda.amp)
  • Distributed training (can add via DataParallel)
  • Learning rate scheduling (can add via PyTorch schedulers)
  • Specialized cubed-sphere convolutions (advanced feature)

These omissions don't affect core functionality and can be added later if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant