Spherical Fourier Neural Operator

Model Overview

SFNO learns dynamical system evolution on the sphere using spherical harmonic transforms, and can be applied to global weather forecasting and spherical shallow-water equation prediction.

Paper: Spherical Fourier Neural Operators: Learning Stable Dynamics on the Sphere

https://proceedings.mlr.press/v202/bonev23a.html

Model Description

This model package invokes NVIDIA's official torch-harmonics linear SFNO implementation and supports SHT on fake spherical fields, one parameter update step, checkpoint recovery, and short-term autoregressive rollout. It is an operator-level smoke package, not a reproduction of the paper's SWE/ERA5 experiments.

Use Cases

Scenario Description
Spherical Operator Research Verify SHT, spectral filtering, and inverse SHT.
Local Rapid Verification Run through training and inference with fake spherical data.
ERA5 Weather Forecasting Subsequently interface with 26- or 73-channel ERA5 data.

Usage

1. OneCode

Click to experience intelligent one-click AI4S programming

2. Manual Installation & Usage

Hardware Requirements

  • CPU can run the current small configuration.
  • GPU is recommended for full ERA5 training.

Download the Model Package

hf download OneScience-Group/Spherical-Fourier-Neural-Operators --local-dir ./Spherical-Fourier-Neural-Operators
cd Spherical-Fourier-Neural-Operators

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
pip install torch-harmonics==0.8.0

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
pip install torch-harmonics==0.8.0

This directory also retains torch-harmonics==0.8.0 under .deps/.

Data

The current scripts generate low-order smooth fake spherical fields in memory and split consecutive time frames into T-1 input/target pairs; no external data download is required.

Training

python scripts/train.py

Training now performs multi-epoch pair Dataset training, time-sequential validation split, learning rate scheduling, and early stopping:

python scripts/train.py --epochs 10
python scripts/train.py --resume weight/training/latest.pth --epochs 20

Inference

python scripts/inference.py

Output files:

weight/model.pth
weight/training/latest.pth
weight/training/best.pth
weight/training/history.json
result/prediction.pt
result/target.pt
result/inference.json

Result Inspection

python scripts/result.py

The current test only verifies that the model executes. Randomly-initialized rollouts do not represent the paper's long-term stability results.

The result script generates result/metrics.json and result/comparison.png. The current RMSE does not incorporate spherical integration weights, and the ACC uses the sample's own spatial mean rather than a long-term training-set climatology; therefore the metrics are not comparable with those reported in the paper.

Paper vs. Current Implementation I/O

Item Paper SWE / ERA5 Current Smoke Configuration
Input / Output SWE 3 fields 256×512 / ERA5 26 or 73 channels [B,2,17,32] smooth synthetic fields
Time Step SWE 1 hour / ERA5 6 hours Consecutive indices with no physical units
Architecture SWE 4×256; weather model 8×384 2 blocks, embed dim 8
Training Single-step training followed by two-step autoregressive fine-tuning Multi-epoch single-step pair training and validation; rollout used for inference analysis
Analysis Spherically weighted relative error and climatological ACC Unweighted smoke RMSE/ACC

The complete execution flow is train.py -> inference.py -> result.py. Training generates z-scored [T,C,Nlat,Nlon] in memory and forms pairs from consecutive frames. The checkpoint config stores only the model configuration, while training parameters are stored separately under train_config, allowing inference to reconstruct the model architecture directly from the checkpoint. The model package is distributed without local training weights or result/ artifacts. A production SWE/ERA5 mode further requires data loading, variable tables, formal train/validation splits, area-weighted loss, and the paper's two-stage training loop.

Real Data

Real-data training requires ERA5 26/73-channel data, 6-hour temporal pairing, training-set statistics, and spherical grid resampling configuration.

OneScience Official Information

Citation & License


中文说明

模型概览

SFNO 使用球谐变换学习球面动力系统的演化,可应用于全球天气预报(weather forecasting)与球面浅水方程预测。

论文 球面傅里叶神经算子(Spherical Fourier Neural Operators):学习球面上的稳定动力学

https://proceedings.mlr.press/v202/bonev23a.html

模型描述

本模型包调用 NVIDIA 官方 torch-harmonics 的线性 SFNO 实现,支持对虚拟球面场执行 SHT、进行一次参数更新、恢复模型权重(检查点)(checkpoint)及执行短期自回归滚动预测。这是算子级冒烟测试包,未复现论文的 SWE/ERA5 实验。

使用场景

场景 说明
球面算子研究 验证 SHT、谱滤波和逆 SHT。
本地快速验证 使用虚拟球面数据跑通训练及推理(inference)。
ERA5 天气预报 后续接入 26 或 73 通道的 ERA5 数据。

使用方法

1. OneCode

点击体验智能一键 AI4S 编程

2. 手动安装与使用

硬件要求

  • CPU 可运行当前小规模配置。
  • 完整 ERA5 训练建议使用 GPU。

下载模型包

hf download OneScience-Group/Spherical-Fourier-Neural-Operators --local-dir ./Spherical-Fourier-Neural-Operators
cd Spherical-Fourier-Neural-Operators

配置运行环境

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
pip install torch-harmonics==0.8.0

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
pip install torch-harmonics==0.8.0

此目录还保留了 torch-harmonics==0.8.0,位置在 .deps/ 下。

数据

当前脚本在内存中生成低阶平滑虚拟球面场,将连续时间帧分成 T-1 个输入与目标配对,无需下载外部数据。

训练

python scripts/train.py

训练目前支持基于配对 Dataset 的多轮训练、按时间顺序划分验证集、学习率调度和早停。

python scripts/train.py --epochs 10
python scripts/train.py --resume weight/training/latest.pth --epochs 20

推理

python scripts/inference.py

输出文件

weight/model.pth
weight/training/latest.pth
weight/training/best.pth
weight/training/history.json
result/prediction.pt
result/target.pt
result/inference.json

结果检查

python scripts/result.py

当前测试仅验证模型能否运行。随机初始化的滚动预测不代表论文中的长期稳定性结果。

结果脚本生成 result/metrics.json 和 result/comparison.png。当前 RMSE 未引入球面积分权重。ACC 使用样本自身的空间均值,未使用长期训练集气候态,因此这些指标无法与论文报告的数值直接比较。

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

项目 论文 SWE / ERA5 当前冒烟测试配置
输入 / 输出 SWE 3 个场 256×512 / ERA5 26 或 73 通道 [B,2,17,32] 平滑合成场
时间步长 SWE 1 hour / ERA5 6 hours 不带物理单位的连续索引
架构 SWE 4×256,天气模型 8×384 2 个块,嵌入维度 8
训练 单步训练后进行两步自回归微调(fine-tuning) 多轮单步配对训练和验证,滚动预测用于推理分析
分析 球面加权相对误差与基于气候态的 ACC 未加权的冒烟测试 RMSE/ACC

完整执行流程为 train.py -> inference.py -> result.py。训练在内存中生成 z 分数标准化的 [T,C,Nlat,Nlon],并用连续帧构成配对。模型权重(检查点)中的 config 仅保存模型配置,训练参数另存在 train_config 下,推理因此可直接从模型权重(检查点)重建模型架构。发布的模型包不含本地训练权重或 result/ 产物。生产用 SWE/ERA5 模式还需数据加载、变量表、正式训练集和验证集划分、面积加权损失,以及论文的两阶段训练循环。

真实数据

真实数据训练需要 ERA5 26/73 通道数据、6-hour 时间配对、训练集统计量和球面网格重采样配置。

OneScience 官方信息

引用与许可证

Downloads last month
25
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support