Pangu-Weather¶
暂无
暂无
暂无
# Download sample input data
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/input_surface.npy -P ./data
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/input_upper.npy -P ./data
# Download pretrain model weight
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_1.onnx -P ./inference
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_3.onnx -P ./inference
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_6.onnx -P ./inference
wget -c https://paddle-org.bj.bcebos.com/paddlescience/models/Pangu/pangu_weather_24.onnx -P ./inference
# 1h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_1
# 3h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_3
# 6h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_6
# 24h interval-time model inference
python predict.py INFER.export_path=inference/pangu_weather_24
1. 背景简介¶
盘古气象大模型(Pangu-Weather)是首个精度超过传统数值预报方法的 AI 方法,其提供了 1 小时间隔、3 小时间隔、6 小时间隔、24 小时间隔的预训练模型。其使用的数据,包括垂直高度上13个不同气压层,每层五种气象要素(温度、湿度、位势、经度和纬度方向的风速),以及地球表面的四种气象要素(2米温度、经度和纬度方向的10米风速、海平面气压)。1 小时 - 7 天预测精度均高于传统数值方法(即欧洲气象中心的 operational IFS)。
同时,盘古气象大模型在一张V100显卡上只需要1.4秒就能完成24小时的全球气象预报,相比传统数值预报提速10000倍以上。
2. 模型原理¶
本章节仅对盘古气象大模型的原理进行简单地介绍,详细的理论推导请阅读 Pangu-Weather: A 3D High-Resolution System for Fast and Accurate Global Weather Forecast。
模型的总体结构如图所示:
其主要思想是使用一个视觉transformer的3D变种来处理复杂的不均匀的气象要素。由于气象数据分辨率很大,因而相比于常见的vision transformer方法,研究人员将网络的encoder和decoder减少到2级(8个block),同时采用Swin transformer的滑窗注意力机制,以减少网络的计算量
模型使用预训练权重推理,接下来将介绍模型的推理过程。
3. 模型构建¶
在该案例中,实现了 PanguWeatherPredictor用于ONNX模型的推理:
其中,input_file 和 input_surface_file 分别代表网络模型输入的高空气象数据和地面气象。
4. 结果可视化¶
先将数据从 npy 转换为 NetCDF 格式,然后采用 ncvue 进行可视化
-
安装相关依赖
-
使用脚本进行数据转换
-
使用 ncvue 打开转换后的 NetCDF 文件, ncvue 具体说明见ncvue官方文档
5. 完整代码¶
| examples/pangu_weather/predict.py | |
|---|---|
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 141 142 143 | |
6. 结果展示¶
下图展示了模型的温度预测结果,更多指标可以使用 ncvue 查看。

