MetNet-3 Compact

Model Overview

MetNet-3 is a regional high-resolution weather forecasting model designed for sparse observations, capable of predicting variables such as precipitation, temperature, dew point, and wind.

Paper: Deep Learning for Day Forecasts from Sparse Observations

https://arxiv.org/abs/2306.06079

Model Description

This directory provides an independent compact smoke implementation based on the paper, preserving multi-source input interfaces, lead-time conditioning, a sparse OMO mask, probabilistic outputs, and HRRR auxiliary regression. The input scale, temporal fusion, MaxViT backbone, and output resolution have all been simplified.

The current model is intended for functional verification only; it is not the official Google implementation and does not provide official pre-trained weights.

Use Cases

Scenario Description
Multi-Source Weather Model Research Verify input interfaces for MRMS, OMO, HRRR, GOES, etc.
Local Rapid Verification Run training, checkpointing, and inference with fake data.
Real Regional Forecasting Subsequently interface with real MRMS, OMO, HRRR, and GOES data.

Usage

1. OneCode

Click to experience intelligent one-click AI4S programming

2. Manual Installation & Usage

Hardware Requirements

  • CPU can run the current compact configuration.
  • GPU is recommended for real data and larger configurations.

Download the Model Package

hf download OneScience-Group/MetNet-3 --local-dir ./MetNet-3
cd MetNet-3

Set Up the Runtime Environment

DCU Environment

conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

GPU Environment

conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

Data

The current model/fake_data.py provides an indexable fake Dataset that generates MRMS, OMO, HRRR proxy, GOES proxy, topography, coordinates, time, and lead-time data and requires no additional download. Each sample excludes the batch dimension; the DataLoader concatenates samples into batches.

Training

python scripts/train.py

The script performs multi-epoch multi-task training, independent validation, learning rate scheduling, and early stopping:

  1. Generates train/validation fake Datasets and multi-task targets;
  2. Validates the input schema on each batch;
  3. Computes precipitation cross-entropy, surface-variable cross-entropy, and HRRR MSE, and updates parameters;
  4. Computes validation loss on an independent validation Dataset;
  5. Saves latest/best checkpoints and history; supports --resume;
  6. The inference stage reads weight/model.pth.
python scripts/train.py --epochs 10
python scripts/train.py --resume weight/training/latest.pth --epochs 20

Checkpoint outputs:

weight/model.pth
weight/training/latest.pth
weight/training/best.pth
weight/training/history.json

Inference

python scripts/inference.py

Inference results:

result/prediction.pt
result/target.pt
result/inference.json

Result Inspection

python scripts/result.py

The current output is generated from fake data and is intended only to verify that the model runs; it does not represent the paper's forecast skill metrics.

The result script generates result/metrics.json and result/comparison.png, reporting precipitation/surface MAE in normalized bin space, HRRR proxy RMSE, and probability normalization error — not the paper's CRPS, CSI, or physical-unit MAE.

Paper vs. Current Implementation I/O

Input / Output Paper Current Compact Configuration
MRMS High 2 channels × 11 frames 4 channels × 3 frames, last frame only used
MRMS Low 1 channel × 1 frame 3 channels × 2 frames, last frame only used
OMO 14 channels × 9 frames 2 channels × 3 frames, last frame only used
HRRR / GOES 618 / 16 channels 8 / 4 proxy channels
Precipitation Output Two target classes, 512 bins each Single target, 16 bins
Surface Output 6 variables, 256/180 bins 6 variables, uniform 8 bins
Backbone Modified 12-block MaxViT Single-layer Transformer proxy
Training Full data with multi-task training Multi-epoch fake Dataset multi-task training

The complete execution flow is train.py -> inference.py -> result.py. Individual fake Dataset samples have input shape [T,C,H,W] and targets as a corresponding multi-task dictionary, with a default spatial size of 8×8; current_time and lead_time are each [1], becoming [B,1] after the DataLoader. The checkpoint is always written to weight/model.pth, and training history with latest/best checkpoints is written to weight/training/. The model package is distributed without these local training weights or result/ artifacts.

Real Data

Real-data training requires MRMS instantaneous/accumulated precipitation, OMO/ASOS station observations, HRRR 617 channels and stale-age, GOES 16 channels, elevation, a common projection, QC, missing-value handling, and normalization statistics.

OneScience Official Information

Citation & License

  • This directory is an independent compact reproduction built according to the MetNet-3 paper.
  • Paper materials, code, and subsequent real data are each subject to their respective licenses.

中文说明

模型概述

MetNet-3 是面向稀疏观测的区域高分辨率天气预报(weather forecasting)模型,可预报降水、温度、露点和风等变量。

论文《利用稀疏观测进行逐日预报的深度学习方法》

https://arxiv.org/abs/2306.06079

模型描述

本目录提供基于论文的独立精简冒烟测试实现,保留多源输入接口、预报时效条件、稀疏 OMO 掩膜、概率输出和 HRRR 辅助回归。输入规模、时序融合、MaxViT 主干和输出分辨率均已简化。

当前模型仅用于功能验证,由本目录独立实现,未随附 Google 官方预训练权重。

使用场景

场景 说明
多源天气模型研究 验证 MRMS、OMO、HRRR、GOES 等的输入接口。
本地快速验证 使用模拟数据运行训练、保存模型权重(检查点)(checkpointing)以及推理(inference)。
真实区域预报 后续对接真实的 MRMS、OMO、HRRR 和 GOES 数据。

使用方法

1. OneCode

点击体验智能一键 AI4S 编程

2. 手动安装与使用

硬件要求

  • CPU 可以运行当前的精简配置。
  • 对于真实数据和更大的配置,建议使用 GPU。

下载模型包

hf download OneScience-Group/MetNet-3 --local-dir ./MetNet-3
cd MetNet-3

配置运行环境

DCU 环境

conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

GPU 环境

conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

数据

当前 model/fake_data.py 提供可按索引访问的模拟 Dataset,生成 MRMS、OMO、HRRR 代理、GOES 代理、地形、坐标、时间和预报时效数据,无需额外下载。每个样本不含批维度,DataLoader 将样本拼接成批。

训练

python scripts/train.py

脚本执行多轮次多任务训练、独立验证、学习率调度和提前停止,步骤如下。

  1. 生成训练和验证所用的模拟 Dataset 及多任务目标。
  2. 在每个批次上验证输入模式。
  3. 计算降水交叉熵、地表变量交叉熵和 HRRR MSE,并更新参数。
  4. 在独立的验证 Dataset 上计算验证损失。
  5. 保存最新和最佳的模型权重(检查点)及历史记录,支持 --resume。
  6. 推理阶段读取 weight/model.pth。
python scripts/train.py --epochs 10
python scripts/train.py --resume weight/training/latest.pth --epochs 20

模型权重(检查点)输出

weight/model.pth
weight/training/latest.pth
weight/training/best.pth
weight/training/history.json

推理

python scripts/inference.py

推理结果

result/prediction.pt
result/target.pt
result/inference.json

检查结果

python scripts/result.py

当前输出由模拟数据生成,仅用于验证模型能否运行,无法代表论文中的预报技巧指标。

结果脚本生成 result/metrics.json 和 result/comparison.png,报告归一化分箱空间中的降水及地表变量 MAE、HRRR 代理 RMSE 和概率归一化误差。论文中的 CRPS、CSI 及物理单位 MAE 均未计算。

论文与当前实现的输入输出对比

输入 / 输出 论文 当前精简配置
MRMS 高分辨率 2 通道 × 11 帧 4 通道 × 3 帧,仅使用最后一帧
MRMS 低分辨率 1 通道 × 1 帧 3 通道 × 2 帧,仅使用最后一帧
OMO 14 通道 × 9 帧 2 通道 × 3 帧,仅使用最后一帧
HRRR / GOES 618 / 16 通道 8 / 4 个代理通道
降水输出 两个目标类别,各 512 个分箱 单个目标,16 个分箱
地表变量输出 6 个变量,256/180 个分箱 6 个变量,统一使用 8 个分箱
主干 修改的 12 块 MaxViT 单层 Transformer 代理
训练 使用全量数据进行多任务训练 使用模拟 Dataset 进行多轮次多任务训练

完整执行流程为 train.py -> inference.py -> result.py。模拟 Dataset 的每个样本输入形状为 [T,C,H,W],目标以对应的多任务字典表示,默认空间大小为 8×8。current_time 和 lead_time 的形状均为 [1],经 DataLoader 处理后变为 [B,1]。模型权重(检查点)始终写入 weight/model.pth,训练历史及最新和最佳的模型权重(检查点)写入 weight/training/。模型包分发时不包含这些本地训练权重或 result/ 产物。

真实数据

真实数据训练需要 MRMS 瞬时及累积降水、OMO/ASOS 站点观测、HRRR 的 617 个通道和数据陈旧时长、GOES 的 16 个通道、高程、统一投影、QC、缺测值处理以及归一化统计量。

OneScience 官方信息

引用与许可证

  • 本目录依据 MetNet-3 论文进行了独立精简复现。
  • 论文资料、代码及后续真实数据分别受各自许可证约束。
Downloads last month
22
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/metnet-3