File size: 4,364 Bytes
3654a86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
license: apache-2.0
language:
- en
tags:
- OneScience
- Earth Science
- GCM
- Neural Parameterization
- Stable Climate
frameworks: PyTorch
---

<p align="center"><strong><span style="font-size: 30px;">NNCAM-Stable</span></strong></p>

# Model Introduction

NNCAM-Stable replaces atmospheric moist physics and radiation in a GCM with neural networks. It targets stable multiyear online climate simulation.

Paper: Stable climate simulations using a realistic general circulation model with neural network parameterizations for atmospheric moist physics and radiation processes  
https://doi.org/10.5194/gmd-15-3923-2022

# Model Description

The model was proposed by teams from Tsinghua University and Scripps Institution of Oceanography. It was trained with two years of SPCAM data containing 122 column inputs and 68 tendency and radiation targets. It supports online CAM5.2 moist-physics and radiation parameterization and stable climate simulation.

# Use Cases

| Use Case | Description |
| :---: | :--- |
| Moist physics | Predict 30-level moisture and dry-static-energy tendencies. |
| Radiation emulation | Predict surface and top-of-atmosphere radiation fluxes. |
| Online stability | Validate long coupled simulations with neural parameterizations. |
| ModelScope/OneCode execution | Validate data, training, inference, climate metrics, and visualization. |
| Multi-GPU training | Start multi-process training through `torchrun`. |

# Usage Instructions

```bash
hf download OneScience-Group/NNCAM-Stable --local-dir ./NNCAM-Stable
cd NNCAM-Stable
```

### 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 should install DTK 25.04.2 or a compatible OneScience-recommended version first.

**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

The paper uses SPCAM simulations with 122 column inputs and 68 moist-physics and radiation outputs. Synthetic data preserve the full dimensions, 30 vertical levels, and three independent parameterization networks while reducing samples, width, and epochs.

```bash
python scripts/fake_data.py
```

### Training

For single-process training, use:

```bash
python scripts/train.py
```

For multi-process training, use:

```bash
torchrun --standalone --nproc_per_node=2 scripts/train.py
```

Training results are saved to:

```text
result/checkpoints/nncam_stable.pt
result/training/metrics.json
```

### Trained Weights

No weights are bundled under `weight/`. The code archive is available at https://doi.org/10.5281/zenodo.5596273 and the training data at https://doi.org/10.5281/zenodo.5625616; the paper does not list a separate directly loadable pretrained-weight file.

### Inference

```bash
python scripts/inference.py
```

Inference produces 30 moisture tendencies, 30 dry-static-energy tendencies, and eight radiation fluxes. Results are saved to:

```text
result/output/predictions.npz
```

### Evaluation and Visualization

```bash
python scripts/result.py
```

Evaluation reports overall RMSE and creates an output-profile figure. 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 NNCAM-Stable specifications.

SPCAM v2, NNCAM source code, model artifacts, and the training and test data remain subject to the licenses and terms of their respective archives.