PrecipDD / README.md
Zhongning's picture
Add Chinese README section
77ccaf6 verified
|
Raw History Blame Contribute Delete
11.7 kB
---
license: apache-2.0
language:
- en
tags:
- OneScience
- Earth Science
- Daily Precipitation
- Climate Change Detection
- Explainable Deep Learning
frameworks: PyTorch
---
<p align="center"><strong><span style="font-size: 30px;">PrecipDD</span></strong></p>
# Model Introduction
PrecipDD estimates annual global mean surface air temperature anomaly (AGMT) from global daily precipitation-anomaly maps to detect anthropogenic climate-change fingerprints. Its dimension-faithful convolutional network supports AGMT regression, emergence-day detection, trend analysis, and occlusion sensitivity analysis.
Paper: Anthropogenic fingerprints in daily precipitation revealed by deep learning
https://doi.org/10.1038/s41586-023-06474-x
# Model Description
The model was proposed by researchers from the Ulsan National Institute of Science and Technology, Pohang University of Science and Technology, and collaborating institutions. It was trained with daily precipitation and annual global mean surface air temperature data from 80 CESM2 Large Ensemble members spanning 1850–2100. The model is suitable for detecting anthropogenic climate-change fingerprints in global daily precipitation fields and estimating annual global mean surface air temperature anomalies. Its key feature is the use of convolutional learning to extract spatial warming signals from precipitation, complemented by emergence-time and interpretability analyses that identify influential regions.
# Use Cases
| Use Case | Description |
| :---: | :--- |
| AGMT regression | Estimate AGMT anomaly from one normalized daily global precipitation map. |
| Emergence-day detection | Measure the fraction of days above the paper's 0.42°C internal-variability bound. |
| Trend and explainability analysis | Compute AGMT and emergence-day trends and a `7×7` occlusion-sensitivity trend map. |
| Local engineering validation | Validate the model workflow with structured synthetic data at full spatial dimensions. |
| ModelScope/OneCode execution | Validate data, training, inference, and evaluation in ModelScope or OneCode. |
| Multi-GPU training | Validate distributed training and checkpoint workflows through `torchrun`. |
# Usage Instructions
## 1.OneCode
[Try intelligent, one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Download and Installation
```bash
hf download OneScience-Group/PrecipDD --local-dir ./PrecipDD
cd PrecipDD
```
### Environment Dependencies
**Hardware Requirements**
- A GPU or DCU is recommended.
- A CPU can be used for connectivity validation with the default small-sample configuration.
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version matching the current cluster, is recommended.
**DCU Environment**
```bash
# Activate DTK and Conda first
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**
```bash
# Activate Conda first
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
```
### Training Data
This repository uses a small synthetic dataset for engineering validation, including normalized daily precipitation anomalies, AGMT labels, years, days of year, and a `55×160` latitude-longitude grid. The synthetic data retain the paper's spatial dimensions, anomaly normalization, and warming-dependent signal while reducing samples, ensemble members, and epochs. These data validate generation, training, inference, emergence detection, trend analysis, and occlusion evaluation only and do not represent the official CESM2 Large Ensemble distribution or paper-scale training.
```bash
python scripts/fake_data.py
```
### Training
For single-GPU training, use:
```bash
python scripts/train.py
```
For multi-GPU training, use:
```bash
torchrun --nproc_per_node=2 --nnodes=1 --master_addr="localhost" --master_port=29500 scripts/train.py
```
Training uses Adam, MAE, L2 weight decay, and independently initialized ensemble members. The default retains the full input and feature dimensions while reducing samples, ensemble members, and epochs. Training artifacts are saved to:
```text
result/checkpoints/precipdd.pt
result/training/metrics.json
```
### Trained Weights
The paper does not provide official model weights that can be used directly by this repository. No weights are bundled under `weight/`, and locally trained checkpoints are for engineering validation only.
### Inference
```bash
python scripts/inference.py
```
Inference loads a locally trained checkpoint and reads held-out daily precipitation anomalies. It averages AGMT estimates across ensemble members while retaining targets, years, days of year, and grid coordinates. The output supports the subsequent metrics and occlusion-sensitivity evaluation only. Inference results are saved to:
```text
result/output/predictions.npz
```
### Evaluation and Visualization
```bash
python scripts/result.py
```
Evaluation computes daily and annual Pearson correlation and RMSE and measures the fraction of days with predicted AGMT above 0.42°C. It also computes AGMT and emergence-day trends and generates a `7×7` occlusion-sensitivity trend map. Synthetic-data results validate engineering only and do not represent formal paper performance. Evaluation results are saved to:
```text
result/evaluation/metrics.json
result/evaluation/comparison.png
```
# Official OneScience Information
| Platform | OneScience Main Repository | Skills Repository |
| --- | --- | --- |
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
# Citation and License
This repository is an independent engineering reproduction of the public PrecipDD specifications, with code licensed under the Apache License 2.0.
The original paper is licensed under CC BY 4.0; the paper and data, including the CESM2 Large Ensemble, remain subject to the licenses and terms of their respective projects.
---
# 中文说明
## 模型简介
PrecipDD 根据全球逐日降水距平图估计年度全球平均地表气温距平(AGMT),用于探测人为气候变化指纹。其保留原始维度的卷积网络支持 AGMT 回归、信号显现日探测、趋势分析和遮挡敏感性分析。
论文:深度学习揭示逐日降水中的人为影响指纹
https://doi.org/10.1038/s41586-023-06474-x
## 模型描述
该模型由蔚山科学技术院、浦项科技大学及合作机构的研究人员提出,使用 CESM2 Large Ensemble 的 80 个成员在 1850–2100 年间的逐日降水及年度全球平均地表气温数据训练。模型适用于探测全球逐日降水场中的人为气候变化指纹及估计年度全球平均地表气温距平。其主要特点是通过卷积学习从降水提取空间增暖信号,并结合信号显现时间和可解释性分析识别影响较大的区域。
## 使用场景
| 使用场景 | 说明 |
| :---: | :--- |
| AGMT 回归 | 根据一张归一化的全球逐日降水图估计 AGMT 距平。 |
| 信号显现日探测 | 衡量超过论文提出的 0.42°C 内部变率界限的日期比例。 |
| 趋势及可解释性分析 | 计算 AGMT 及信号显现日的趋势,并生成 `7×7` 遮挡敏感性趋势图。 |
| 本地工程验证 | 使用保留完整空间维度的结构化合成数据验证模型流程。 |
| ModelScope/OneCode 运行 | 在 ModelScope 或 OneCode 中验证数据、训练、推理(inference)和评估。 |
| 多 GPU 训练 | 通过 `torchrun` 验证分布式训练和模型权重(检查点)(checkpoint)流程。 |
## 使用指南
### 1.OneCode
[体验智能一键 AI4S 编程](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
### 2. 下载与安装
```bash
hf download OneScience-Group/PrecipDD --local-dir ./PrecipDD
cd PrecipDD
```
#### 环境依赖
**硬件要求**
- 建议使用 GPU 或 DCU。
- 可使用 CPU 在默认小样本配置下进行连通性验证。
- DCU 用户须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的与当前集群匹配的版本。
**DCU 环境**
```bash
# Activate DTK and Conda first
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 环境**
```bash
# Activate Conda first
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
```
#### 训练数据
本仓库使用小型合成数据集进行工程验证,包含归一化逐日降水距平、AGMT 标签、年份、年积日和 `55×160` 经纬网格。合成数据保留论文的空间维度、距平归一化处理及随增暖变化的信号,同时缩减样本、集合成员和训练轮数。数据仅用于验证生成、训练、推理、信号显现探测、趋势分析和遮挡评估,无法代表官方 CESM2 Large Ensemble 的分布或论文训练规模。
```bash
python scripts/fake_data.py
```
#### 训练
单 GPU 训练
```bash
python scripts/train.py
```
多 GPU 训练
```bash
torchrun --nproc_per_node=2 --nnodes=1 --master_addr="localhost" --master_port=29500 scripts/train.py
```
训练采用 Adam、MAE、L2 权重衰减以及独立初始化的集合成员。默认配置保留完整输入及特征维度,同时缩减样本、集合成员和训练轮数。训练产物保存到以下位置。
```text
result/checkpoints/precipdd.pt
result/training/metrics.json
```
#### 训练权重
论文未提供本仓库可以直接使用的官方模型权重。`weight/` 下未附带权重,本地训练得到的模型权重(检查点)仅用于工程验证。
#### 推理
```bash
python scripts/inference.py
```
推理加载本地训练的模型权重(检查点),读取留出的逐日降水距平。推理对各集合成员的 AGMT 估计取平均,并保留目标、年份、年积日及网格坐标。输出仅用于后续指标和遮挡敏感性评估。推理结果保存到以下位置。
```text
result/output/predictions.npz
```
#### 评估与可视化
```bash
python scripts/result.py
```
评估计算日及年的 Pearson 相关系数和 RMSE,并衡量预测 AGMT 超过 0.42°C 的日期比例。评估还计算 AGMT 和信号显现日的趋势,生成 `7×7` 遮挡敏感性趋势图。合成数据结果仅用于工程验证,无法代表论文正式性能。评估结果保存到以下位置。
```text
result/evaluation/metrics.json
result/evaluation/comparison.png
```
## OneScience 官方信息
| 平台 | OneScience 主仓库 | Skills 仓库 |
| --- | --- | --- |
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
## 引用与许可证
本仓库是对公开 PrecipDD 规范的独立工程复现,代码采用 Apache License 2.0 许可。
原始论文采用 CC BY 4.0 许可。论文及包括 CESM2 Large Ensemble 在内的数据仍受各自项目的许可证和条款约束。